Setup Linux ftp server - Install and configure vsftpd in Slackware
FTP is an Internet file transfer protocol. It's used widely to transfer data between the Internet, WAN and LAN network around the world. In Slackware Linux, ftp server and ftp client are included in default installation. Proftpd is a default ftp server in Slackware for many years but starting from version 10.2, Slackware ships vsftpd in the official packages as well. In this tutorial, we'll learn how to setup vsftpd as ftp server in Slackware Linux and configure vsftpd.conf file to customize ftp server to our needs.
If you are using other Linux distribution, you can also use this tutorial as a guide. The vsftpd ftp server package comes with Fedora and other major distributions too but if you can't find it in your Linux, you can download the package from your Linux distribution's website or source from the vsftpd official website.
This tutorial is a beginner's guide on how to setup vsftpd ftp server in Slackware Linux. The tutorial covers:
- Check vsftpd in Slackware Linux
- Install vsftpd in Slackware Linux
- Configure vsftpd as Slackware ftp server
- Restart vsftpd ftp server
- Test vsftpd ftp server
Firstly, we need to check vsftpd package in our Linux system. Normally we can use Linux package management system to check installed package and use Linux ps command to verify the running service. We can also check log for installed packages. In Slackware Linux, we can use pkgtool to check whether vsftpd has been installed or not. See example below:
Open Linux terminal and type pkgtool and press enter.
Use arrow down key and choose View option to view the list of files in a package.
Press v key to go the package name start with v. Press arrow key and search for vsftpd.
Press enter to read information about vsftpd package. The Very Secure FTP Daemon was written by Chris Evans.
Press Tab key to move cursor to the Cancel button. Enter to exit.
Press Tab key again to move cursor to the Cancel button. Enter to exit.
You can also check vsftpd package in /var/log/packages:
root@slackware:~# ls /var/log/packages/ | grep vsftpd vsftpd-2.0.7-i486-1 root@slackware:~#
We can see that vsftpd is already installed in my Slackware. Don't worry, here is a guide on how to install vsftpd in Slackware in case yours is not installed:
The less hassle way to install vsftpd in Slackware Linux is using slackpkg. However, you need to install and configure slackpkg before you can use it because slackpkg is not installed by default. You also need an Internet connection. See Slackware package management system on how to use slackpkg. To install vsftpd using slackpkg, invoke the command below:
root@slackware:~# slackpkg install vsftpd
The easiest way is to use pkgtool and install vsftpd from Slackware dvd installer. You have to mount Slackware dvd installer before issuing the pkgtool command. In the pkgtool main menu, choose to install from other directory and provide the path of the mounted Slackware dvd installer.
If you don't have the installer, then the final choice would be downloding vsftpd package from Slackware packages website: Slackware packages. Then use installpkg command: installpkg [-m] packagename to install vsftpd.
vsftpd stands for very secure file transfer program daemon. It's secure, light and the most popular ftp server at the moment. To configure vsftpd server, let's take a look at the configuration file, vsftpd.conf. Issue vim /etc/vsftpd.conf command to open the configuration file with vim text editor and edit to suite your need (of course you can use any text editor that you prefer).
root@slackware:~$ vim /etc/vsftpd.conf
Note: You must have root privilege to edit and save the file. If you login as a normal user, use 'su -' command and enter root password.
This script is straight forward. There shouldn't be any problem to understand the script even for a first time user. Remove comment (remove #) to allow any rules and options.
# # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd.banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd.chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. ls_recurse_enable=YES # # To run vsftpd in standalone mode (rather than through inetd), uncomment # the line below. #listen=YES
Now we must activate vsftpd daemon to start using our ftp server. In slackware, we can do this by editing the super server, inetd.conf. Type vim /etc/inetd.conf and remove comment at the beginning of vsftpd line:
# Very Secure File Transfer Protocol (FTP) server. ftp stream tcp nowait root /usr/sbin/tcpd vsftpd
Enter :wq! to save the vsftpd.conf file and exit vim editor.
Now we can restart vsftpd service so that the new configuration take effect. If you are using the default Slackware vsftpd configuration as in the example above, you can restart inetd with the command below:
root@slackware:~$ root@slackware:~$ /etc/rc.d/rc.inetd restart
The inetd super server starts automatically during Slackware booting. If you need to start inetd manually, you can use the same command as above and replace 'restart' with 'start'. See example below:
root@slackware:~$ root@slackware:~$ /etc/rc.d/rc.inetd start
To test our new ftp server, open a new terminal and login as a normal user. Login to the ftp server by typing ftp at the command prompt. See an example below:
luzar@slackware:~$ ftp ftp> open (to) example.org Connected to example.org.
If you can connect to the ftp server, that means you successfully setup vsfpd ftp server in Slackware Linux. Depends on how you configure vsftpd.conf file, you must provide username, whether it's local user account or anonymous. You can find more about ftp client commands at Linux ftp tutorial - FTP client guides.