1

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.

  • 2
    What OS? People are answering based on assumptions but assumptions are the mother of all stuff-ups. – John Gardeniers May 28 '11 at 12:13
2

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/

1

To add a user just use the following command

adduser <username>

As for how to restrict them to their home directory hopefully the answers to this question will help

0

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

-1

To add a user with home folder you can use this command (on ubuntu):

useradd -d /home/username -m username
passwd username 
  • That's not what he is asking. – Frands Hansen May 28 '11 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.