- ProFTPd This server, http://proftpd.org, is one of the more popular of the very complex FTP servers. It ships with most major Linux distributions. Its configuration file is modeled after that of Apache, and the server supports many advanced features.
- vsftpd This server aims to excel at security, stability, and speed. In doing so, its developers have chosen to ignore some of the more advanced features of servers such as ProFTPd and WU-FTPD. If you don’t need those features, this tradeoff may be more than acceptable. You can learn more from its website, http://vsftpd.beasts.org.
- WU-FTPD The Washington University FTP Daemon (WU-FTPD) is an old standard in the Linux world. Unfortunately, it’s collected more than its fair share of security problems and isn’t the speediest FTP server available. For these reasons, it ships with fewer Linux distributions today than in years past. Its main website is http://www.wu-ftpd.org.
- PureFTPd This server, headquartered at http://www.pureftpd.org, is another FTP server that emphasizes security. SuSE ships with a version of this server.
- oftpd This server is unusual because it’s designed to function only as an anonymous FTP server; it doesn’t support logins using ordinary user accounts. This feature can be appealing if you only want to run an anonymous server, but it makes this server unsuitable for many other purposes. It’s available from http://www.time-travellers.org/oftpd/.
First of all, I installed the vsftpd daemon using yast. one can install it by installing the respective packages in their servers.
Second install PAM 1.0 if not available there. In my case it is already installed.
Third install DB43 or compat-DB for converting password text file to DB file(hash).
Now come the configuration....
1:- The PAM is already install in the SUSE machine. It is basically used for authorization and authentication purpose. Go /etc/pam.d and edit vsftpd to look like this--
# Uncomment this to achieve what used to be ftpd -A.
# auth required pam_listfile.so item=user sense=allow file=/etc/ftpchroot onerr=fail
session optional pam_keyinit.so force revoke
auth required /lib/security/pam_userdb.so db=/etc/vftpusers
account required /lib/security/pam_userdb.so db=/etc/vftpusers
#Uncomment the following line for anonymous ftp.
#auth sufficient pam_ftp.so
#auth required pam_shells.so
#auth include common-auth
#account include common-account
#password include common-password
#session required pam_loginuid.so
#session include common-session
2:- Now create a file vftpusers.txt in /etc directory contating the user name and password like--
3:- Now convert the text file to the db file using command
db_load -T -t hash -f /etc/vftpusers.txt /etc/vftpusers.db
In case of users using DB42 module, use command
db42_load -T -t hash -f /etc/vftpusers.txt /etc/vftpusers.db
and set mod to 644.
4:- Now create a directory in the '/home' with name virtualftp
5:- Create a user virtualftp by using the command
useradd -d /home/virtualftp/ virtualftp
6:- Make the owner of virtualftp folder to virtualftp using command
chown -R /home/virtualftp virtualftp
7:- Change the mode of folder to 755 using
chmod 755 /home/virtualftp
8:-Now login as virtualftp user and create the folder "testing" in /home/virtualftp/. This is for virtual user 'testing' home ( storage area).
After this lets configure the vsftpd.conf file which handles the configuration of vsftp inside /etc/.
9:- The vsftpd.conf file should look like this--
ftpd_banner="Welcome to MY FTP service."
After configuration you can see the file without commnets by using--
sed '/^ *#/d;s/#.*//' /etc/vsftpd.conf
10:- Now restart the service by using command
service vsftpd restart
11:- Test the FTP
abhimanyu@GLC001:~/Desktop> ftp 192.168.100.167
Connected to 192.168.100.167.
220 "Welcome to MY FTP service."
Name (192.168.100.167:abhimanyu): testing
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
229 Entering Extended Passive Mode (|||30333|)
150 Here comes the directory listing.
-rw-r--r-- 1 1001 100 8368115 Mar 26 16:38 mail
226 Directory send OK.
Note :- You should keep your firewall in shut state to test this setting.
After configuration, you can allow port 21, 20 and higher port for passive mode 30000 - 31000 in firewall or directly editing the iptables file.
To create user by script, I used below script with user 'root'
# Name: Createuser.sh
# Description: Add users to /etc/vftpusers.txt and recreate the database
# Author: Abhimanyu
# Special: email@example.com
# Version: 1.0
# Arguments: $1=Username $2=Password
if [ $# -ne 2 ]
echo “Username and Password needed as argument !”
echo $1 >> /etc/vsftpusers.txt
echo $2 >> /etc/vsftpusers.txt
db_load -T -t hash -f /etc/vsftpusers.txt /etc/vsftpusers.db
chown /home/virtualftp/$1 virtualftp
Test it and post your experience...