How to Setup FTP Server on Debian-based Linux

By | October 3, 2014

FTP or File Transfer Protocol is a network protocol that used to transfer files between host to another host. With FTP server you can make your own private storage or for other purposes, FTP is build on a client/server architecture, this tutorial just explain the FTP server and how to setup FTP Server on Debian-based Linux ?

Step 1

Boot up your Linux, then open up your favorite terminal, and type

$ sudo apt-get install vsftpd

and just wait till the installation is completed, if you get an error “Unable to locate package” you should update your repository, by enter this command :

$ sudo apt-get update

So what is vsftpd ? vsftpd(Very Secure File Transfer Protocol daemon) is an FTP server for Unix like system, for some linux distribution vsftpd is the default FTP server.

Step 2

Now let’s open vsftpd configuration files, to open type :

$ sudo vim /etc/vsftpd.conf

I’ll use vim as my editor you can use your own editor like nano or pico , joe, gedit, or anything else, then press enter to open your configuration, and Viola ! a bunch of text will come up.

Setup FTP Server on Debian-based Linux 1

I’ll try to explain some of the configuration with my own version explaination, hope you understand my explaination.
If a line has a # (comment) marks, just delete # (comment) marks to active those configuration.

listen=YES
This configuration means FTP Server will listen on IPv4 socket not for IPv6.

listen_ipv6=YES
This configuration means listen on IPv6 instead of IPv4.

anonymous_enable=YES
Allow anonymous login to your FTP, so anyone can login to your server without any credentials.

local_enable=YES
Allow local users to login to your server.

write_enable=YES
Enable any form of write command.

local_umask=xxx
Change user mask for local users, user mask is a command to setting files and directories permission.

anon_upload_enable=YES
Allow anonymous user to upload their files.

anon_mkdir_write_enable=YES
Allow anonymous user to create directory.

dirmessage_enable=YES
Show Messages to users when they go into a certain directories.

use_localtime=YES
Enable directory listing with your local timezone.

xferlog_enable=YES
Enable logging for any kind of downloads and uploads.

connect_from_port_20=YES
Port for transfer connections originate from port 20.

chown_uploads=YES
chown_username=opnux
Arrange uploaded anonymous user files to be owned by a different user, in this tutorial all anonymous files will be owned by opnux.

xferlog_file=/var/log/vsftpd.log
Change Log file location.

xferlog_std_format=YES
Enable log file in standard ftpd xferlog format.

idle_session_timeout=600
If user is idle for 600 seconds then, that user will be logout automatically.

data_connection_timeout=120
If no data connection for 120 seconds, then user will be logout automatically.

ftpd_banner=Welcome to blah server
Enable and Configure Welcome message for every user that connect to your ftp server.

After you edit vsftpd configuration file, don’t forget to save !

That’s all for the configuration, so let’s go to the next step.

Step 3

Now in this step just run your vsftpd service by doing this following command :

$ sudo service vsftpd start

or if your vsftpd service has been started just restart the service :

$ sudo service vsftpd restart

Setup FTP Server on Debian-based Linux 2

Step 4

Last step test your ftp server, you can use your own favorite FTP client, i’ll use default FTP Client.

$ ftp localhost

then enter your credentials, if it success, Congratulations ! you’ve been setup your own FTP Server.

Setup FTP Server on Debian-based Linux 3

If you have and suggestion for tutorial : Setup FTP Server on Debian-based Linux, please comment or contact me via the contact page, thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *