On successful login to server /home/ user_homedir_1/ user_datadir_1 will be loaded by default as we have added config in step 5 and other folders/file of the server will not be accessed.
Now you can access the server via FTP using the serving host, key as the above downloaded private key.
Sftp setup for multiple users on linux download#
Download private key and use that to access server via FTP. you will need to convert private key into PPK format for putty.Add below configs at the end of the file.ĪllowUsers ec2-user testuser1Match User testuser1ĬhrootDirectory /home/user_homedir_1/user_datadir_1.Edit sshd_config to add user access setting and group setting.Create ssh directory in the home directory and set up public/private keys for accessing the server and home folder of the user.Ĭat testuser1.pub > /home/user_homedir_1/.ssh/authorized_keysĬhown testuser1:sftp testuser1 testuser1.pub.Create /home/user_homedir_1 directory and setup directory access mode and owner.Ĭhown root:root user_homedir_1cd /home/user_homedir_1.Useradd -g sftp -d /home/user_homedir_1 testuser1 First, create a group named sftp (add only if there is no sftp group else no need to add):.In below setting/configs, using “testuser1” as username and directory “user_homedir_1” to allow access for “testuser1”.Īccess server via terminal/ssh/command line and then follow steps to executed mentioned commands for setup.
By following steps mentioned below, you can allow a user(s) to access the server via FTP and allow access to only their home directories.