Introduction
ProFTPD is a popular open-source FTP server that can also be used to serve Secure File Transfer Protocol (SFTP) using the OpenSSH package. By default, ProFTPD listens on port 21 for FTP and port 22 for SFTP. However, you might want to change the SFTP port to avoid conflicts with other services or improve security. In this article, we will guide you through the process of configuring ProFTPD to serve SFTP on a non-standard port, such as 2222.
Installing ProFTPD and OpenSSH
First, you need to install ProFTPD and OpenSSH on your Ubuntu system. Open a terminal and run:
sudo apt update
sudo apt install proftpd openssh-server
Configuring ProFTPD
After installation, edit the /etc/proftpd/proftpd.conf file:
sudo nano /etc/proftpd/proftpd.conf
Find the following lines:
# Uncomment the following line and edit as needed to allow remote logins
#DefaultRoot ~
# Uncomment the following line and edit as needed to allow local logins
DefaultRoot ~
# Change the following line to specify the user and group that the ProFTPD daemon will run as
#RunAsUser proftpd
#RunAsGroup proftpd
Add the following lines at the end of the file:
# SFTP Configuration
# Create a new user for SFTP
User myuser
# Set the home directory for the user
Root /home/myuser
# Set the shell to /usr/sbin/sshd
Shell /usr/sbin/sshd
# Enable write access for the user
WriteEnable Yes
# Enable SFTP on a non-standard port
Port 2222
Replace "myuser" with the desired username.
Restarting ProFTPD and OpenSSH
Save and close the file. Restart ProFTPD and OpenSSH:
sudo systemctl restart proftpd
sudo systemctl restart ssh
Testing the Configuration
Use an SFTP client to connect to your server on the new port:
sftp myuser@your_server_ip_address:2222
If the configuration is successful, you will be prompted for the user's password.
In this article, we have shown you how to configure ProFTPD to serve SFTP on a non-standard port, such as 2222, on an Ubuntu system. By following the steps outlined above, you can secure your SFTP service and avoid conflicts with other services.