# Ftp without credentials

**URL:** <https://discourse.chef.io/t/ftp-without-credentials/5592>\
**Category:** Chef Infra (archive)\
**Created:** [July 7, 2014, 7:06am UTC](https://discourse.chef.io/t/ftp-without-credentials/5592 "2014-07-07T07:06:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Indra\_k](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@Indra\_k](https://discourse.chef.io/u/Indra_k)\
**Post date:** [July 7, 2014, 7:06am UTC](https://discourse.chef.io/t/ftp-without-credentials/5592/1 "2014-07-07T07:06:04Z")

</div>

Hi,

I am transferring tar file using cookbook.i have no username and password for my ftp server so how to login and transfer using cookbook :  
my code is here:

#!/usr/bin/ruby  
require ‘net/ftp’

# Login to the FTP server

ftp = Net::FTP.new(node[‘ip\_address’])  
ftp.login  
ftp.chdir(node[‘source\_directory’])  
ftp.getbinaryfile(node[‘package\_name’], node[‘dest\_directory’])  
ftp.close

I ve also tried by passing credentials as nil to user and pwd but it too doesnot works.  
it shows

Net::FTPPermError

172.16.1.121 530 Login incorrect.  
172.16.1.121

Thanks,  
indra

---

<div class="post-metadata">

**Author:** ![Stephen\_Nelson\_Smith](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Stephen\_Nelson\_Smith](https://discourse.chef.io/u/Stephen_Nelson_Smith)\
**Post date:** [July 7, 2014, 7:50am UTC](https://discourse.chef.io/t/ftp-without-credentials/5592/2 "2014-07-07T07:50:02Z")

</div>

Hi,

On 7 July 2014 08:06, Indra k [indra.k@cloudenablers.com](mailto:indra.k@cloudenablers.com) wrote:

> Hi,
> 
> I am transferring tar file using cookbook.i have no username and password  
> for my ftp server so how to login and transfer using cookbook

I accidentally replied only to Indra, thus:

The remote file resource supports FTP. This should 'just work'.

> **[remote\_file Resource](https://docs.chef.io/resources/remote_file/)**
>
> Use the remote\_file resource to transfer a file from a remote location using file specificity. This resource is similar to the file resource.

...

He replied:

> Thanks stephen . it works.

🙂

S.
