Configure VSFTPD on Slackware Linux

Published: {ts '2011-08-09 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/configure-vsftpd-on-slackware-linux/

FTP short for File Transfer Protocol is a method of transferring files between computers over the Internet, WAN's and LAN's. FTP requires two programs, a server to host the files and a client to communicate with the server. Slackware Linux comes with both a ftp server and ftp client are included by default. Proftpd has been the default ftp server in Slackware for years but from version 10.2, Slackware now ships with vsftpd in the official packages also. Here I will outline how to setup and configure vsftpd in Slackware Linux to replace Proftpd .

Virtual Users

Before going on it is worth mentioning that Slackware does not come with PAM installed and thus the version of vsFTPD that ships with Slackware does not have PAM support.

For this reason if you wish to have virtual ftp users you must first install pam on slackware and then recompile VSFtpd with pam support.

Step 1: Ensure VSFTPD is Installed

On a normal installation vsftpd should be installed by default but it is worth checking. To see if it is currently installed we use slackwares package tool as follows.

Installing vsftpd

The easiest way of installing vsftpd if it is not already installed is to use the slackpkg tool. This tools makes life very easy, if you dont have it I advise you to install it. It can be found in the extra directory of your install disc

slackpkg install vsftpd

Step 2: Set VSFTPD as your ftp server

To setup vsftpd as our ftp server we must edit the "inetd.conf" file which is our super server and calls the vsftpd daemond.

vi /etc/inetd.conf

Scroll down the file until you find the following section. Uncomment the ftp line and save the file.

# Very Secure File Transfer Protocol (FTP) server. ftp stream tcp nowait root /usr/sbin/tcpd vsftpd

Step 3: Configure VSFTPD

Next we need to configure vsftpd based on our needs. Simply open the file and uncomment/modify each line as makes sense for your requirements.

vi /etc/vsftpd.conf

Create List of Users who may use FTP

For my configuration I am going limit what users can use ftp and lock them to their home directory. Note: Never add the root user to this list.

To do this we first create a file "/etc/vsftpd.user_list" and add each user we want to give ftp access. Put each username on a new line.

vi /etc/vsftpd.user_list

Next we open the vsftpd.conf file (as above) and set the following three lines to select this list, enable it and set its mode to allow only those listed (as opposed to deny those listed). # Set the userlist_file to /etc/vsftpd.user_list # Set the userlist_enable to yes to use this file # Set the userlist_deny to NO so that only users listed can ftp # as opposed to users listed being excluded userlist_file=/etc/vsftpd.user_list userlist_enable=YES userlist_deny=NO

Finally we ensure that the listed users can only access their own home directory by enabling this setting>

# Lock down local users to home directory chroot_local_user=YES

Step 4: Restart the Super Daemon

Now we restart the inetd super daemon.

/etc/rc.d/rc.inetd restart

Step 5: Test the FTP server

Finally to test the ftp server we simply open another terminal window as one of the listed users and run the following commands. it is also a good idea to repeat this test for a non listed user to ensure our settings are working as expected

$ ftp ftp> open (to) example.org Connected to example.org.

Thats it, happy ftp'ing