Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am currently running linuxmint and openssh. I have 2 accounts on my computer Joe and Bob. I have the keys and passphrase created by joe stored in the /home/joe/.ssh/ folder. I can connect to Joe using ssh/sftp. but I can not connect to Bob. My question is do I have to create a new set of keys for Bob in order to connect to him even though both accounts are on the same machine? Also I have tried to chroot jail for sftp users (Subsystem sftp internal-sftp) I get locked out of BOTH accounts when trying to use it. It worked when I was using a password instead of a key passphrase.

Thank you

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I can connect to Joe using ssh/sftp. but I can not connect to Bob.

How I see it: Joe has the public key and it in an authorized_keys file and Bob doesn't

My question is do I have to create a new set of keys for Bob in order to connect to him even though both accounts are on the same machine?

You can copy the public key into Bob's authorized_keys file. Try ssh-copy-id bob or edit the /home/joe/.ssh/authorized_keys on Bob.

Permissions on HOME directories must deny group and "others" write for SSH keys to work since the .ssh directory could be renamed and re-created as directory write permission controls that.

Also I have tried to chroot jail for sftp users (Subsystem sftp internal-sftp) I get locked out of BOTH accounts when trying to use it. It worked when I was using a password instead of a key passphrase.

You sound to me like you want to use scponly which is in APT, try apt-get install scponly.

share|improve this answer
    
Thank you so very much this is exactly what I was looking for –  Reese Apr 9 '13 at 0:09
    
You're welcome! :) –  user179510 Apr 9 '13 at 15:17

In order to log in to a user account on a remote machine using SSH, you need the public key for the account to be in the ~/.ssh directory for the account, and you need the private key that matches the public key to be in the ~/.ssh directory on the local machine from which you are attempting to connect.

You can use the -i option to ssh to explicitly specify another file other than the default private key file in ~/.ssh.

You can use the same private and public key pairs for any number of users. However, the keys must match, that is the must have been created as a pair. If you lose a private key, it is not possible to recover the public key. If you loose the public key you can regenerate it from the private key using an openssl command.

You can put public keys for additional users who you wish to allow to log into an account in ~/.ssh/authorized_keys.

Other than having the private key file in ~/.ssh on the remote machine, the most common error that prevents you from logging in is file permissions. Make sure that your ~/.ssh directory permission is no more than 700 and that the file permissions on any private keys, id_dsa or id_rsa are no more than 400.

share|improve this answer
    
Thank you so very much for your help. I figured out how to use the pubkey :) –  Reese Apr 9 '13 at 0:11

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.