Skip to content

FTP Server using ProFTPD

Set up an FTP server on PC1 using ProFTPD, allowing clients to upload and download files via FTP.

Step-by-Step Procedure

1. Update Package Repository and Install ProFTPD

bash
sudo apt-get update
sudo apt-get install proftpd
  • During installation, select "standalone" mode using the arrow keys and press Enter.

2. Configure ProFTPD Settings

Edit the main configuration file:

bash
sudo nano /etc/proftpd/proftpd.conf

Make the following changes:

  • Disable IPv6:
apache
UseIPv6 off
  • Set a custom server name:
apache
ServerName "CNLAB.com"
  • Uncomment to restrict FTP users to their home directories:
apache
DefaultRoot ~
  • Enter the absolute path for the folder to be set for serving:
apache
RequireValidShell on
  • Uncomment authentication module line:
apache
AuthOrder mod_auth_unix.c

Save and exit:
Press Ctrl + OEnterCtrl + X


3. Add /bin/false to Valid Shells

This step ensures that users with /bin/false as their shell can still authenticate for FTP.

bash
sudo nano /etc/shells

Add this line at the end:

/bin/false

4. Create FTP User

Create a user with restricted shell access and assign a home directory:

bash
sudo useradd -d /var/www/ -s /bin/false ftpuser
sudo passwd ftpuser

When prompted, enter and confirm a password (e.g., myftp123).


5. Create FTP Directory and Set Ownership

Ensure the user's home directory exists and has correct permissions:

bash
sudo mkdir -p /var/www/
sudo chown ftpuser:ftpuser /var/www/
sudo chmod 755 /var/www/

chmod 755 allows read & execute access to others so FTP commands work.


6. Allow FTP Through the Firewall (If UFW Is Enabled)

If the firewall is active, allow FTP traffic:

bash
sudo ufw allow 21/tcp
sudo ufw reload

7. Restart ProFTPD Service

Apply the configuration changes:

bash
sudo systemctl restart proftpd

8. Test FTP Connection from Client PC (PC2 or PC3)

On another PC in the same network:

bash
ftp 172.20.10.X

Replace X with PC1’s actual IP address.
Log in using:

  • Username: ftpuser

  • Password: myftp123 (or your chosen password)


9. Test File Upload/Download

Inside the FTP session:

bash
ftp> put Hello.txt      # Upload a file
ftp> get Hello.txt      # Download a file
ftp> ls                 # List directory contents
ftp> quit               # Exit FTP session

10. Fixing Common Errors (Permission Denied)

If you see:

550 Hello.txt: Permission denied

Run:

bash
sudo chown ftpuser:ftpuser /var/www/
sudo chmod 755 /var/www/
sudo systemctl restart proftpd

Final Verification

  • FTP login should succeed using ftpuser.

  • Uploads (put) and downloads (get) should complete without errors.

  • Directory listing (ls) should show files in /var/www/.

Made with ❤️ for students, by a fellow learner.