Server - Contents

FTP

File Transfer use ProFTP and Filezilla

revised: 19-Apr-2023

Step01: Add the FTP server:

root# apt -y install proftpd

Choose the default 'Standalone option' and press the [return] key.

Usage

To link to this FTP server, use a FTP client such as Filezilla. Get it here: (Filezilla Download)
Use these settings and upload files:
logon Filezilla
Host: [host-IP eg. 192.168.1.83 or 'example.com' ] Port:[empty]
Protocol: SFTP-SSH Protocol
Logon Type: Normal
User:[username] eg. root
Password: [not-necessary if one has used the SSH keypair. Note: one may need to add to FileZilla the private key (for user: root). To add the private key, go to Edit-> Settings-> FTP-> SFTP ]

Security Measurements

Tip#01 To prevent unwanted attempts to use FTP, switch on Fail2Ban for proFTP via Webmin [Fail2Ban]->[Filter Action Jail]->[proFTP]. Remember to restart Fail2Ban to effect the changes.

Secondly, consider turning off the FTP server for security reasons, if FTP is not often needed (Open Webmin, go to Servers ->proFTP, there is a 'Start' or 'Stop' button. If ProFTPd has not appeared in the Server list, click on the 'Refresh Modules' button and go back to 'Servers'. Note that the default settings are sufficient to allow a FTP client such as FileZilla to logon with the above described settings.

The proftpd server can also be started or stopped with these commands via the console:

root# systemctl start proftpd
root# systemctl stop proftpd
root# systemctl status proftpd   // to exit: ctl+c

Recommended: One should now add a regular user eg. such as 'sammy' and give the user 'sudo' privileges. The user 'sammy' is used as an example in most of these pages.

root# adduser sammy
root# usermod -g www-data sammy    //the group 'www-data' is for permissions with the webserver
root# gpasswd -a sammy sudo  // confer 'root' privileges.
Note: The above command to give user: sammy with sudo rights may fail. Try the following:
root# visudo
Then enter below the line featuring root ALL=(ALL:ALL) ALL the following:
sammy ALL=(ALL:ALL) ALL ...and exit.
Tip#02: It is highly recommended to use a SSH key pair to login for each new user added to the server. To do this after creating the SSH key pair specifically for sammy (for a review,see point 4 of the Virtual Server page, continue with these steps below to place the public key in sammy's home directory.
Tip#03: It is highly recommended also to activate the proFTP entry in the Fail2Ban application to prevent unauthorize use. Go to Webmin->Networking->Fail2Ban->Filter. Action Jails and enable 'proFTP' as well as 'Webmin-auth'.
root# su sammy
sammy$ cd ~
sammy$ mkdir -p ~/.ssh
sammy$ nano ~/.ssh/authorized_keys // Copy and paste public key here
sammy$ chmod 700 ~/.ssh // set the permissions
sammy$ chmod 644 ~/.ssh/authorized_keys

Using FileZilla with user 'sammy': Following the settings above for FileZilla (user: root), one creates a new logon choice, by changing the user to 'sammy' but also linking the setting to sammy's private key: go to Edit-> Settings-> FTP-> SFTP to addthis key.

Logging on the Server with user 'sammy': Using PuTTY and, as per step 2 in the Fundamental Setup page, one creates a new logon choice with user: sammy with a link to sammy's private key.

Server - Contents