

This group will be used to restrict SFTP users to their home directories. The Match Group directive will create a group “sftp”.

Open the sshd_config file using vi editor, $ sudo vi /etc/ssh/sshd_configĬhange ‘ Subsystem sftp /usr/lib/openssh/sftp-server‘ to ‘ Subsystem sftp internal-sftp‘Īdd the following lines at the end of the file: Match group sftp


Once you have created group and new user, you need to configure the SSH server to allow SFTP access. In the last, grant full permissions to user’s home directory, run $ sudo chmod 700 /home/sftpuser/ 3) Configure SSH Server Now, create a user and add it to sftp group, $ sudo useradd -m sftpuser -g sftpĪssign password to sftpuser, $ sudo passwd sftpuser Before creating a user, let’s first create group with a name “ sftp” $ sudo groupadd sftp It’s always a good practice to create a new user for SFTP transfers. $ sudo apt install ssh -y 2) Create SFTP Group and User To install SSH server, open your terminal and type the following command: $ sudo apt update If you need to add a new user who needs to edit the files of the existing user, then you need to create a new user using the same UID and GID.To set up an SFTP server, you need to have an SSH server installed. Now you can start the FTP-server: service vsftpd startĪdd some changes to the file /etc/hosts.allow, prohibit access from all IP-addresses except for those that you are going to use to connect to the FTP-server: /etc/hosts.allowĪdd a user, prohibit ssh connection, create a home directory.Īfter the user is created, change the password: useradd user_name -shell /usr/sbin/nologin -home-dir /path_to_directory The file is quite detailed and understandable, yet we recommend that you change some of the settings: /etc/nfīefore starting an FTP-server, add the line /usr/sbin/nologin to the file /etc/shell, so the users could connect to the FTP without shell access: echo "/usr/sbin/nologin" > /etc/shell To install it, run the command: apt-get install vsftpdĪfter the process is completed, an FTP can be considered installed.Īfter installation, the first thing you need to do is to configure the FTP-server to fit your needs using the file located in /etc/nf. VSFTPD is a popular FTP-server that is located in Ubuntu standard repository. If you need to upload files on a server or give access to your employee/colleague so they would set up your website, an FTP-server will be the best solution.Īll commands during the FTP-server installation are to be performed by a root user: sudo su.
