Setting up an FTP server on a Ubuntu 16.04 PC

From Wiki Knowledge Base | Teltonika Networks
This is the approved revision of this page, as well as being the most recent.

Summary[edit | edit source]

vsftpd, (or very secure FTP daemon), is an FTP server for Unix-like systems, including Linux. It is licensed under the GNU General Public License. It supports IPv6 and SSL.
vsftpd supports explicit (since 2.0.0) and implicit (since 2.1.0) FTPS.
vsftpd is the default FTP server in the Ubuntu, CentOS, Fedora, NimbleX, Slackware and RHEL Linux distributions.
You will see the vsftpd server configuration on a Ubuntu 16.04 PC.

Configuring VSFTPD in Ubuntu[edit | edit source]

Install the vsftpd with command sudo apt-get install vsftpd

When installation is completed, open vsftpd.conf configuration file with command sudo nano /etc/vsftpd.conf (example below)

Nano default.png

Server configuration[edit | edit source]

Now you have to configure your server. You have to find specified lines and change or uncomment them. For an easier way to find specific lines, you can press “CTRL+W” and it will show where the line is.
Lines that has to match with an example:
Uncomment the “write_enable=YES”, “ascii_upload_enable=YES” and “ascii_download_enable=YES” lines and make sure that the value of them is “YES

Line1.png

Line2.png

Scroll a little bit down and and find the section as shown in an example below.

Change the “chroot” settings Add the following lines:
user_sub_token=$USER
chroot_local_user=YES
chroot_list_enable=YES
Change the default “chroot” settings. Add the following lines:
chroot_list_file=/etc/vsftpd.chroot_list
local_root=home/$USER/Public_html
*If any of these lines already exist, remove the “#” before each line.
Uncomment “ls_recurse_enable=YES” line and make sure that the value is “YES

Chroot.png

When configuration looks the same as in example, press “CTRL+X”, type “y” and press “Enter” button on your keyboard.

Creating users[edit | edit source]

Create a new user by typing “sudo adduser USERNAME” (for example, “sudo adduser test2").

Adduser.png

Adding Usernames to the CHROOT list[edit | edit source]

Open the “vsftpd.chroot_list” text file by typing “sudo nano /etc/vsftpd.chroot_list
Type in your own username, press “Enter” on your keyboard and repeat with any other usernames of people whom you want to have access their Home directories from within your server.

Chroot users list.png

Save your list by pressing “CTRL+X”, typing “y” and pressing “Enter” button on your keyboard.

Restart VSFTPD by running “sudo service vsftpd restart”.

Accessing your server[edit | edit source]

In Ubuntu terminal[edit | edit source]

You can test server accessing with different users, which you entered before to the “vsftpd.chroot_list”.
You have to check your server’s IP address by running command “ifconfig”. Your “inet addr” is your server’s IP address. (for example 192.168.10.10)

Ifconfig.png

You can simply access your FTP server by runing “ftp localhost” command. For example, the user “test2” is in the “vsftpd.chroot_list” file. But user “test” is not, so login failed.

Test2user.png
Testuser.png

If you want to close server, just type “bye”.

Using FileZilla[edit | edit source]

Install FileZilla by typing “sudo apt-get install filezilla” in your Ubuntu terminal.

Run Filezilla by typing “filezilla” in terminal.

This window appears:

Filezilla.png

Connection tab. Type in your host (eg. 192.168.10.10), Username (eg. “test2”), password and press “Quickconnect” button.

If connection and logging in are successful, you will see your home directory in remote site window.

At the left side you can navigate in your Local site, search for files to upload.

Filezilla logedin.png

Uploading files to remote site[edit | edit source]

Just simply select the file from your local site and drag it to the remote site. If upload is successful, you will see that the value of “Successful transfers” has changed.
If not, you can see the problem in “Failed Transfers” tab.

Draging.png