Sometimes, we need to use an FTP server. This time I decided to configure ProFTPD. On this post, I’m going to guide you on how to install Proftpd on Linux.
First, install ProFTPD:
apt–get install proftpd–basic
Now, configuring proftpd, open the file /etc/proftpd/proftpd.conf.
Enter the name of your server in the line:
ServerName “server”
After that, we will open access only within the home folder of the virtual user. To do this, uncomment the line:
DefaultRoot ~
Now we remove the requirement for the user to have it. To do this, uncomment the line:
RequireValidShell off
We include the necessary module for authorization (mod_auth_file is responsible for authorization from the file), adding after the section:
# This is required to use both PAM-based authentication and local passwords
# AuthOrder mod_auth_pam.c* mod_auth_unix.c
AuthOrder mod_auth_file.c
and then we indicate where exactly the files for authorization will lie:
AuthUserFile /etc/proftpd/ftpd.passwd
AuthGroupFile /etc/proftpd/ftpd.group
Now let’s move on to creating users. Let’s create the files we need to store the accounts in:
touch /etc/proftpd/ftpd.passwd
touch /etc/proftpd/ftpd.group
To add users, we have the ftpasswd utility.
ftpasswd —passwd —name=user —home=/home/ftp —shell=/bin/false —uid=1003 —file /etc/proftpd/ftpd.passwd
user – username
/home/ftp – home folder
ProFTPD will refuse to use files with 777 permissions (which is true on the part of the developer), but the ftpasswd utility will give the files 440 permissions and the root: root owner, and because of this, ProFTP will not be able to read these files.
Therefore, just change the owner to ProFTP:
chown proftpd:root /etc/proftpd/ftpd.passwd
chown proftpd:root /etc/proftpd/ftpd.group
service proftpd restart