Ubuntu Linux vsftpd ftp service / server install, configuration howto

by Vivek Gite · 29 comments

Q. How do I install Ubuntu ftp service or server?

A. Ubuntu Linux comes with various ftp servers to setup FTP service such as:
=> proftpd - Versatile, virtual-hosting FTP daemon

=> vsftpd - The Very Secure FTP Daemon

=> ftpd - FTP server

=> wu-ftpd - powerful and widely used FTP server

=> wzdftpd - A portable, modular, small and efficient ftp server

=> pure-ftpd - Pure-FTPd FTP server

I recommend using vsftpd. It is simple and quite secure FTP server. According to vsftpd man page:

vsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.

=> Default ftp port : 21
=> Default configuration file : /etc/vsftpd.conf

How do I set up the vsftpd daemon to accept connections from another computer?

The configuration of the vsftpd FTP service (read as daemon ) simply requires three steps.

Step # 1: Install vsftpd

Type apt-get command to install vsftpd
$ sudo apt-get install vsftpd
Output:

Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  vsftpd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 121kB of archives.
After unpacking 438kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
Fetched 121kB in 0s (246kB/s)
Selecting previously deselected package vsftpd.
(Reading database ... 31396 files and directories currently installed.)
Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
Setting up vsftpd (2.0.4-0ubuntu5) ...
Adding system user `ftp' with uid 106...
Adding new user `ftp' (106) with group `nogroup'.
Not creating home directory `/home/ftp'.
 * Starting FTP server: vsftpd

Step # 2: Configure /etc/vsftpd.conf

The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
$ sudo vi /etc/vsftpd.conf

Add the following line (uncomment line) to the vsftpd configuration file:
local_enable=YES
Above config directive will allow local users to log in via ftp

If you would like to allow users to upload file, add the following to the file:
write_enable=YES

For security you may restrict local users to their home directories. Add the following to the file:
chroot_local_user=YES

Save and close the file.

Step # 3: Restart vsftpd

To restart vsftpd type the command :
$ sudo /etc/init.d/vsftpd restart
Output:

* Stopping FTP server: vsftpd                                                                                       [ ok ]
 * Starting FTP server: vsftpd                                                                                       [ ok ]

How do I use ftp command line utility?

Now you should be able to FTP to this server with any account that exists on the system except for the root user. From Windows or other Linux system use ftp client, type the command:
$ ftp ftp.nixcraft.in
Output:

Connected to ftp.nixcraft.in.
220 (vsFTPd 2.0.4)
Name (ftp.nixcraft.in:vivek): vivek
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 1000     1000        91798 Aug 16 08:26 apf-current.tar.gz
-rwxr-xr-x    1 1000     1000          156 Nov 10 07:05 iptables.stop
drwxr-xr-x    3 0        0            4096 Dec 23 11:11 postfix
-rw-r--r--    1 0        0        10481942 Nov 29 23:35 webmin_1.310_all.deb
226 Directory send OK.
ftp> quit
221 Goodbye.

Open FTP port using iptables (optional)

Add following rules to your iptables script. Assuming that default incoming policy is drop. If protocol is TCP and destination port is 21 (ftp):
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
See - How do I open open ftp port 21 using iptables for more information.

There are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
$ man vsftpd.conf

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 29 comments… read them below or add one }

1 yuanlao5 01.26.07 at 4:38 am

i want to use root to login my ftpserver. can you teach me how to setup it?

2 vishal parikh 02.12.07 at 10:48 am

hi
after logging to the username, i am able to do get command (able to
download the files) but i am not able to upload the files. message
received
ftp> put vish
227 Entering passive mode (127,0,0,1,188,16)
553 Could not create file.

pls help me

vishal parikh

3 Anand Shankar 02.13.07 at 2:30 am

The default setup for vsftpd makes the /home/ftp directory for ftp server use. I had been using vsftpd on fedora where this directory was /var/ftp/. In my new ubuntu installation I had kept /var partition large to accomodate ftp site files.

How do I change the default behaviour in ubuntu to make /var/ftp as the default ftp home in place of /home/ftp??

anand

4 Mohan 05.22.07 at 9:42 am

If the user conect with ftp, he should be login in his home dir only.

how to set this home dir option.(no permisson view other dir)

5 nixcraft 05.22.07 at 11:01 am

Mohan,

Use vsftpd chroot feature

6 ehsan 11.13.07 at 10:27 am

hi
i want to anynom users can visit /myftp folder and download some files.

then i want to users lik u1,u2,u3 can login to ftp
and can upload,change files in /myftp sub folders.

u1 should have access to /myftp/folder1
u2 should have access to /myftp/folder1 and /myftp/folder2
u3 should have access to /myftp/ all folders
anonym should not access to /myftp/folder3 !

is it possible?
i’m using FC6 with vsftpd2.0.5
HEPL PLZ!

7 Mahajan 11.22.07 at 11:44 am

i want to login in root in local desktop through http://ftp…….PLz. help…

8 Ralph 03.27.08 at 1:25 am

Great short step-by-step instructions for getting an FTP server running under Ubuntu. So easy to follow! Thank you.

9 only_samurai 05.22.08 at 4:17 pm

vishal: you need to edit the /etc/vsftpd.conf file and uncomment write_enable=YES

10 Andres 06.15.08 at 6:29 pm

Hello!,

Thanks for this great tutorial. I just followed your instructions and now it is nicely running :-)

I installed it on Ubuntu 8.0.4

Thanks again!!!

11 Jim 07.29.08 at 1:56 am

After setting this up, is there a way I can log into this and see if it works from the same machine/pc? thanks

12 Jesse 01.01.09 at 9:47 pm

i just got the ftp working. but when i try to upload an index.html file to my public_html folder. I get a 403 forbidden error. if i create the file on the web server it works great. any ideas because i don’t want to have to type everything into a file on the server thanks

13 Jesse 01.01.09 at 10:19 pm

never mind figured it out

14 Mark 01.08.09 at 12:03 am

Hi, I just followed your instructions, But when i type “ftp http://ftp.nixcraft.in” into ssh, i get “-bash: ftp: command not found”

Any idea whats wrong here?

Thanks

15 ahmed 01.17.09 at 1:22 pm

hello,
thanks for tutorial, but i have some problem,
when anonym upload file, they can download it?
thanks

16 ahmed 01.17.09 at 1:24 pm

sorry doble post,
i mean anonym can’t download that file…
thanks

17 diego 01.18.09 at 3:41 am

Excellent and simple :)

18 Sylvester 01.27.09 at 1:05 am

Hi

I have a question on vsftpd,

While setting the below settings (vsftpd.conf)

write_enable=YES
listen=YES
anonymous_enable=NO
local_enable=YES
virtual_use_local_privs=YES
write_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
guest_enable=YES
user_sub_token=$USER
local_root=/opt/ftpimages/teamf/$USER
chroot_local_user=YES
chroot_list_enable=YES
hide_ids=YES
userlist_enable=NO

But, while using FileZilla clinet still I can able to go to other directories like “/, /etc/, /boot” and could even transfer the file to my PC?

Can you advise is there any setting is wrong?

Thanks,

-Sylvester

19 Patrik 04.04.09 at 9:47 pm

@Sylvester:
I think your problem might revolve around the usage of both
chroot_local_user=YES
chroot_list_enable=YES
(since when chroot_local_user is YES, the chroot_list_enable becomes a list of people who ISN’T being chrooted.
May this perhaps be the stumbling block?

20 João Ramos 06.12.09 at 9:53 am

Thank you very much! :)

21 Les 07.16.09 at 2:47 am

I would like to setup a site where users can download(only) installers. The idea here is that users will click the installer they want to download and a window will appear asking if they want to open or save the installer . No need for username or emailaddress. On the .asp of the site I will hardcode the ftp location of the installer. Please help me on how I could setup my ftp server installed in linux fedora 6. I use vsftpd installed on the linux server. The installers are also located on the linux box.

22 byron 07.31.09 at 4:42 am

I have vsftpd setup. I can connect via command line with my home server’s IP address and the domains setup as virtual hosts. I cannot, however, connect through FileZilla when I use anything other than the IP address behind my router. Something I need to configure? Something I forgot to configure, maybe? Hope someone can help me out. Thanks.

23 Kedibone 08.04.09 at 7:16 am

can somebody help to setup a PROFTPD server with the following settings:
don’t allow anonymous logins
files copied to the server must by default have rwxrwxrx permissions
the user will be locked in student’s home directory
maximum of 5 users can FTP to the server at the same time
maximum download speed for nay user is 100kbytes
pass the configuration file

24 anil y 09.17.09 at 8:54 am

plz help me
i cannot access the other end ftp user acount in ubuntu linux server,

what is the way to access?

thanking u
Anil

25 Sreejith 09.22.09 at 2:45 pm

Hi,
I installed the ftp service.But could not connect it using http://ftp.nixcraft.in
Could you pls clarify what does nixcraft stands for.
When i create a ftp service,the ftp address will be http://ftp..com.
What will be X, Is it my computer name ? or User Name ?

Please clarify
Thanks in Advance

26 Vivek Gite 09.22.09 at 7:37 pm

nixcraft.in is my domain name. You need to create subdomain called http://ftp.nixcraft.in by editing bind zone files. However, if your dns hosted with ISP, contact them or use their control panel to create ftp subdomain.

HTH

27 Jan 10.03.09 at 5:00 pm

Short and Excellent guide for getting FTP on ubuntu.
Thank you !

28 rahul 11.11.09 at 4:34 pm

could you please send me the complete details to configure ftp server in linux

29 Kaloyan 02.08.10 at 6:12 pm

Hallo, fellows!
I followed all steps in this guide but on the end result is the following:
$ sudo /etc/init.d/vsftpd restart
* Stopping FTP server: vsftpd
No /usr/sbin/vsftpd found running; none killed.
[ OK ]
* Starting FTP server: vsftpd [ OK ]

What is “No /usr/sbin/vsftpd found running; none killed.” supposed to mean and how could I get over it?

And another question: What is the meaning of these rows in vsftpd.conf:
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
What actually means “Run standalone”?

Thank you!!!

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All