Where to place public ssh keys for users?

B3rt

Verified User
Joined
Oct 12, 2007
Messages
81
I wish to add a ssh key for 1 specific user/domain so that the user can login using ssh without entering a password.

Normally you add the key to ~/.ssh/authorized_keys and it works.
I test it for the root user and this works, but for the domain there is no .ssh folder and files.

I created a file called "authorized_keys" in /home/<username>/.ssh and added the key, of course I first enabled and tested the SSH account.
I can login normally using SSH of this domain, after adding the jey into authorized_keys this user should be able to login without entering a password.

You guessed it, no go.... still a password prompt.

What do I wrong here or must I add the key somewhere else?

(the key works, as soon as I add the key at the root user it can login without any password)
 
I created a file called "authorized_keys" in /home/<username>/.ssh and added the key, of course I first enabled and tested the SSH account.

Have you checked to make sure there are no line feeds in the key?

Rick
 
Last edited:
Check the ssh daemon configuration file for your server; my guess is that users are handled differently.

Jeff
 
I don't know if someone is still looking for this. But i have made two bash scripts for issue. One to place public keys at existing users and one for new users. Only thing you need to do is adding the public key in /root/authorized_keys. The scripts will copy that file into the users ~/.ssh/ dir. I have added a ZIP to this reply.

Important note
Don't add your customer public key in the file /root/authorized_keys!! Because if you do your customer can login to every user. You must enter them by hand. And activate SSH for user(s).
 

Attachments

There is no reason to give users ssh access ever. What is the point in this?
 
There is no reason to give users ssh access ever. What is the point in this?

If you restrict your DirectAdmin installation only for your employees and you don't want them to login as root and protect passwords. So there's a reason to give SSH-access toe DirectAdmin users ;).
 
Back
Top