How to Install FTP on Ubuntu
Posted on February 27th, 2017
In this tutorial, we can check how to install FTP server on an Ubuntu system.
File Transfer Protocol ( FTP ) is a network protocol for transferring or downloading files between the systems. FTP uses the client/server model for the same. The server component called FTP daemon listens to the FTP requests from the client, and it sets up the connection between the systems. During this session, an FTP client can execute commands in the system. FTP server stores the files from the system and allows them to access those files from different systems.
We can manage the FTP server access in two ways, either Anonymous or Authenticated. By using the Anonymous method, the client can use the default user and send their email address as the password to access the FTP server. Whereas, in the Authenticated method, a client should have a username and password to access the server. During the FTP connection, the daemon will change the root directory of the server to the FTP Home directory and also hides the rest of the file system from remote sessions.
Installing the FTP Framework
1) Before installing the FTP server, you should upgrade the Ubuntu version. After upgrading the Ubuntu version, restart the system.
sudo apt-get upgrade
2) Install the FTP framework using the VSFTPD install command. This installation will take some time to complete, so be patient.
sudo apt-get install vsftpd
3) Install FileZilla program which is used to access and upload files into the server.
sudo apt-get install filezilla
Change the Configuration file
1) Before making any changes to the configuration file, we need to take a copy of the same for backup.
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
2) Edit the vsftpd.conf file to enable or disable certain VSFTPD features.
sudo nano /etc/vsftpd.conf
3) To allow the local users to log in to the FTP server, you need to remove the “#” from the local_enable=YES line. If it is already enabled, then there won’t be a “#” symbol in front of this command.
4) Uncomment the write_enable=YES line to allow the FTP write command.
5) We can disable the “ASCII mangling” by uncommenting the below two lines under the heading “#ASCII mangling is a horrible feature of the protocol.”.
ascii_upload_enable=YES
ascii_download_enable=YES
6) Scroll down to the #Chroot heading and then add the below lines. If any of these lines exist, remove “#” before each existing line.
user_sub_token=$USER
chroot_local_user=YES
chroot_list_enable=YES
7) Edit the default “chroot” settings by adding the below lines under the heading # (default follows). If any of these lines exist, remove “#” before each existing line.
chroot_list_file=/etc/vsftpd.chroot_list
local_root=/home/$USER/Public_html
allow_writeable_chroot=YES
8) Scroll down to the heading, you may activate the “-R” option …. and uncomment the below:
ls_recurse_enable=YES
9) Save and exit the vsftpd.conf file.
Add Usernames to the CHROOT List
Open the chroot text file and then add the usernames to the list for whom you want to access their Home directories from within the server. After adding the username, you can save the file.
sudo nano /etc/vsftpd.chroot_list
To ensure that the changes have been updated, we should restart the VSFTPD. After this, you will be able to access your FTP server.
sudo systemctl restart vsftpd
Testing FTP Access
1) The IP address can be determined by entering ifconfig in the terminal and then reviewing the “inet addr” number. If “ifconfig” is not installed, then you can install the same by entering the below command.
sudo apt-get install net-tools
2) Then you need to forward your router’s port 21 slots to that IP address; the port should use TCP protocol and not UDP.
3) You can connect to the server by typing FTP [address] in the terminal. Only the users added in the vsftpd.chroot_list file should be able to connect to the server, and others should get a connection failed error.
Accessing FTP using FileZilla
1) Open the FileZilla app and then open the “Site Manager” under the File option.
2) Click the “New Site” option under the Site Manager and add the server address in the “Host” tab. Then add the forwarded port number as 21 into the “Port” text field. Then click “Connect” to connect your computer to your FTP server.
3) After connecting, you can move the files by dragging and dropping the files or folders from the server to the remote system.
This is the end of this tutorial. We hope that now you know how to install and configure FTP server in an Ubuntu system.
If you require any additional information or need any further help, please get in touch with our support team via [email protected].
what about the firewall on ubunto ?
Hello Robin,
CSF/IFD is always an option for free
vsftpd.chroot_list not present in /etc directory.
OK to create one or ?
Also what is the structure and format of entries please.
One grateful NOOB