I need a user with specific homefolder. This user should read and write in his folder. And he cant read any other folder in the server.
I need a user with specific homefolder. This user should read and write in his folder. And he cant read any other folder in the server.
There are two possible ways of achieving this.
The first is to build a chroot environment for that user. To do that it is required that you build a new root with all the necessary binaries, libs and such for that user to work. It is quite complicated and especially if you are somewhat new to using *nix.
If you only require that the user has access to the files that can be done through SFTP if you use an OpenSSH version above 4.9 without any extra add-ons or modifications. I have written a blog post on this subject here: http://blog.frands.net/sftp-only-chroot-users-with-openssh-in-debian-166/
To add a user just use the following command
As for how to restrict them to their home directory hopefully the answers to this question will help
The best method to bind a user to his home directory is to use "rbash" which stands for "restricted" bash. Using this, not only the user won't have any permissions to other directories but his home. He won't be able to change directory to elsewhere (cd /root will be denied, for example)
To do this, open /etc/passwd with root access using any editor (vi, vim or nano) after the user and his/her home directory are created. Find the line which contains the user record and simply replace /bin/bash with /bin/rbash
To add a user with home folder you can use this command (on ubuntu):