Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
1  
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

1 Answer 1

qwertymk,

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.

Example:

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

 
discard

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.