How to setup and configure an FTP server in Linux

Last updated on 22nd January 2015

This article shows you how to setup and configure an FTP server on Linux using vsftpd.

vsftpd (Very Secure FTP Daemon) is a fast, stable and secure FTP server for UNIX and Linux systems. It is the default/recommended FTP server on many Linux distributions like RHEL, Centos, Fedora and Ubuntu.


1. Installation

On RHEL and other RPM based systems :
yum install vsftpd

During installation a user named ftp is created with the home directory/var/ftpThis is the default ftp directory

On Ubuntu and Debian based systems :
apt-get install vsftpd


2. Starting & Stopping vsftpd

vsftpd RPM installs the /etc/rc.d/init.d/vsftpd script which can be used to start and stop vsftpd

To start vsftpd server, run the command
/sbin/service vsftpd start

To stop vsftpd server, run the command
/sbin/service vsftpd stop

To restart vsftpd server, run the command
/sbin/service vsftpd restart


3. Configuration

The main configuration options for vsftpd can be found in /etc/vsftpd/vsftpd.conf file. This file contains directives that lets you customize the FTP server. The directives are specified in the form option=value

So of the commonly used configuration options are

ftpd_banner : By default vsftpd displays a standard banner when a connection is established to the server. You could set your own message using this directive.
ftpd_banner=Welcome to my FTP service

anonymous_enable : By default the value of this directive is set to YES, which enables anonymous users to log in. The usernames anonymous and ftp are allowed anonymous access by default. To disable anonymous access set anonymous_enable=NO

ftp_username : When anonymous access is allowed you can specify the local user account used for the anonymous FTP. The home directory of this user is /var/ftp. The default value for this option is ftp.

no_anon_password : When this directive is set to YES, the anonymous user is not prompted for a password. The default value is NO.

local_enable : This directive should be set to YES to allow local users(users in /etc/passwd) to log in. Default is YES

write_enable : The default value for this directive is YES which allows ftp clients to issue commands like DELETE and RNFR that update files in the target server

download_enable : File downloads are allowed when this directive is set to YES. Default is YES.

listen_address : If you have multiple IP addresses on the server, you can specify the IP address on which vsftpd listens for network connections.

userlist_enable : When this option is set to YES and userlist_deny directive is also YES the users listed in the file /etc/vsftpd/user_list are denied access.

userlist_deny : When userlist_enable directive is YES and userlist_deny=NO only the users listed in /etc/vsftpd/user_list file are allowed access.

Conclusion

vsftpd is probably one of the best ftp server when it comes to security, perfomance and stability. There are numerous configuration options in vsftpd that gives you the ability to fine tune your ftp server making it one of the most versatile ftp software on Linux and Unix platforms


Post a comment

Comments

Nothing yet..be the first to share wisdom.