How to Create FTP Accounts via SSH

A new server has only the root user, and FTP logins as root are not allowed because FTP sends passwords unencrypted. If you need an FTP user but there is no ISPmanager or other control panel on the server, you can create one over SSH. Run all commands as root.

Plain FTP does not encrypt data or passwords. If your client supports it, use SFTP instead: it works over SSH and needs no extra server. See our SFTP guide.

Install ProFTPD

Skip this step if ProFTPD is already installed. On Ubuntu and Debian:

apt install proftpd

On AlmaLinux and Rocky Linux, ProFTPD is in the EPEL repository:

dnf install epel-release
dnf install proftpd

Start the service and enable it at boot:

systemctl enable --now proftpd

Where Is proftpd.conf

Depending on your operating system, the configuration file is located at:

  • Ubuntu and Debian: /etc/proftpd/proftpd.conf
  • AlmaLinux and Rocky Linux: /etc/proftpd.conf

Restrict FTP Users to Their Home Directory

By default, ProFTPD may let users browse directories outside their home directory, even if they cannot change anything there. This can be a security risk. To fix it, add this line to the end of proftpd.conf:

DefaultRoot ~

Save the file and restart the FTP server:

systemctl restart proftpd

Create an FTP Account

Regular FTP users do not need shell access. Before creating users, add /bin/false to the list of allowed shells:

echo '/bin/false' >> /etc/shells

Create the user and set a password:

useradd username -d /home/folder_name -m -s /bin/false
passwd username

Replace username with the name of the new user and /home/folder_name with its home directory. If the directory already exists, omit the -m option. The /bin/false shell blocks shell access for this user.

Shell access

If the user needs shell access, specify the path to a real shell instead of /bin/false, for example /bin/sh or /bin/bash. Standard FTP users do not need it, so it is better not to grant it.

Restrict FTP User Permissions

You can, for example, deny writing to the home directory and allow it only in one subfolder, such as upload. Run as root:

chmod 555 /home/folder_name
mkdir /home/folder_name/upload
chown username:username /home/folder_name/upload

In the last command, the second username is the group name. By default, Linux creates a group with the same name as the user.

If you need a server for file storage, take a look at our Storage VPS plans.

Blog
Subscribe to our Newsletter