Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Thank you so much for the detail answer. I tried. But it still doesn’t work. What is the best way to debug SSH issue? what command should i use?
When it comes to setting up multi-user SFTP, there’s a little more involved. Setting up an SSH Key for each user is one of those steps, but you also need to modify the configuration a little more and setup a group for these users.
To get started, in the configuration you posted, find this line and comment it out:
Subsystem sftp /usr/lib/openssh/sftp-server
So it should look like the following when commented out.
#Subsystem sftp /usr/lib/openssh/sftp-server
Directly below that line add the following:
Subsystem sftp internal-sftp
Match group sftpusers
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Hit CTRL + X and save your changes. Now you’ll need to create the group sftpusers:
sudo addgroup sftpusers
Now restart SSH:
service ssh restart
Now that SFTP is setup, you need to make sure that each user is added to the sftpusers group. Any user that isn’t part of this group won’t be able to use SFTP.
To add a user to the sftpusers group:
sudo usermod -g sftpusers username
where username is the username of the user you’re trying to add. It’s also a good idea to make sure the users shell is set to /bin/nologin, and to do that we’d run:
sudo usermod -s /bin/nologin username
where, as above, username is the username of the user you’re modifying.
The last few steps consist of making sure directory permissions are correct and assume that each user resides in /home (i.e. /home/username).
For each user’s home directory, we need to setup proper ownership. To do this, we’ll change the ownership of /home/username to the user and group root:
chown root:root /home/username
Now, directories and files below ./username/ need to be owned by the user themselves and the group needs to be set to sftpusers, so if we created:
/home/username/htdocs
We’d need to change ownership of ./htdocs to the user and our sftp group, like so:
chown username:sftpusers /home/username/htdocs
The same applies to files, so if we have index.php, index2.php, and index3.php in ./htdocs, we need those files to be owned by the same user:group as our directories. To do this, we can run:
chown -R username:sftpusers /home/username/htdocs/
Which recursively changes ownership.