Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was looking up how to let multiple user ssh onto my server with the authorized_keys file.

I need to tweak it so that each user logs into a specific directory for each user (ie joeBlah can only see ~/folder34).

I'm doing this so that I can have 3 different people working on different parts of a site and not letting them onto other parts of the site (ie joeBlah can work on public_html/forum and buddy on ~/public_html/contact).

From what I can tell it comes down to editing the command= in authorized_keys but I can't find anything else on the topic.

Is there a way to specify each users home dir which is some arbitrary location on the server?

share|improve this question
The command parameter runs the specified command when an SSH session is established - essentially disabling the shell. The home directory is typically just a starting place - users can still visit other directories. It sounds like you are looking to setup a chroot jail. You may look into jailkit as a starting point. – cyberx86 Feb 19 '12 at 4:06
it sounds like the OP needs to just setup accounts for these users, and add their pubkey to the correct /home/user1/.ssh/authorized_keys file – Tom H Feb 19 '12 at 6:59


The authorized_keys file is where public keys are placed for public key authentication. The file would not be the correct place to set users home directories.

Do those three users have their own account on the system or are you just adding separate public keys for joeblah and buddy while they log in with the same system account?

If each user has their own account on the system you can change their home directory with usermod.


usermod -d /path/to/public_html/forum joeblah

The command above would make it so when joeblah logged in he would be placed in /path/to/public_html/forum (assuming permissions are adequate).

Please provide more details about your setup if you want a more direct solution.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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