I installed SSH, but I found if I use my original account to login to Ubuntu, it has too many permissions.
I want to constrain the user to only have permissions for specific folders in Ubuntu. How can I configure such a user?
This is simple. Just create a new user with it's home directory set to the one you need him to have access to (this command must be run under
This will create an user
If you have the directory already, you can run
If you need to make even world-writable directories unaccessible for this user, there are two variants.
1) If you want to provide an interactive shell session to the user, then consider following this manual on creating a chroot jail (in your
After that add following to your
2) If you only need him to copy files between his endpoint of connection and your host, everything is much easier. Add these lines in end of your
Then comment out the
After restarting your SSH server (it does not kill interactive sessions on restart, so it is safe even if you misconfigured something; also, does not close your running session before you have checked that you are still able to log in), everything should work as intended.