changing home dir for new user

July 1, 2014 2k views

I added a new user and it has added the user in the home dir. I want to give the user access only to a certain part of the server, how can this be done. I want him to have access to "/usr/share/nginx/public_html" directory only. Can someone help with the right command because i am not a developer. Thanks

3 Answers

You can change a user's home directory by running the following command:

sudo usermod -d /usr/share/nginx/public_html username
  • Note however that this does not lock the user only to that directory, they're still able to CD out. To lock them to it you'll need to use chroot.

chroot? how can i do this and thank you very much for the help

tried the above and when i log in as that user to WinSCP it still direct to the home directory. I want to lock him in the above directory and limit his privileges.

Have another answer? Share your knowledge.