Linux Tips and Tricks

Linux Tips and Tricks

Passwordless FTP setup – Linux

September15

Normally when you are using ftp command, it will ask username and password to connect to that specified ftp host.

we will see how to setup the password less FTP setup.

Today i installed the FTP server in my ubuntu.

In the terminal type the below command and provide the password to install the FTP server.

1
$ sudo apt-get install vsftpd

After that open the below file and modify the anonymous_enable value to YES

1
2
3
4
$ sudo vi /etc/vsftpd.conf
 
# Allow anonymous FTP? (Disabled by default)
anonymous_enable=YES

Now restart the vsftpd service by using the below command.

1
2
3
4
5
6
7
8
9
10
#before restart - PID is 3599
$ ps -ef | grep vsftpd
root      3599     1  0 23:25 ?        00:00:00 /usr/sbin/vsftpd
 
$ sudo restart vsftpd
vsftpd start/running, process 3691
 
#after restart - PID is 3691
$ ps -ef | grep vsftpd
root      3691     1  0 23:33 ?        00:00:00 /usr/sbin/vsftpd

All set to go. Try to connect to your localhost.

username : anonymous
password : anonymous

1
2
3
4
5
6
7
8
9
10
$ ftp localhost
Connected to localhost.
220 (vsFTPd 2.2.2)
Name (localhost:kamaraj): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

So, now successfully connected to our localhost ftp server.

Now, we will see how to setup passwordless ftp configuration.
It is very simple.

create a file .netrc under your home directory.And put the contents which is shown as below.

The format is : machine login password

1
2
3
4
5
$ pwd
/home/kamaraj
 
$ cat .netrc 
machine localhost login anonymous password anonymous

Note: Make sure .netrc is atleast having the read permission (400) permission for the user.

That’s all.

Now, we will try to login into localhost.

1
2
3
4
5
6
7
8
$ ftp localhost
Connected to localhost.
220 (vsFTPd 2.2.2)
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

This time ftp didn’t ask the username and password.

Have Fun 🙂

posted under Uncategorized

Email will not be published

Website example

Your Comment:


Recent Comments

    Categories