0

I'm new to the concept of SSH & password-less authentication.

I'm trying to setup password-less SSH connection between two servers A & B, using SSH-keygen.

If I generate the keys on "Server A" as "root" user, can all the other users on "SERVER A" use the password-less SSH connection?

(or)

Do I need to create separate keys for each and every user?

I'm trying to set up password-less SSH connection for a set of specific users, including root user.

anarxz
  • 176
  • 4
Kurk
  • 1

1 Answers1

0

No, generating key pair for root user is not "applied" to other users.

You can generate one key pair and then copy the same public key to any user's ~/.ssh/authorized_keys of the computer you need to access. That way you can connect everywhere through the same user@computer. To other computers also. Or even from other users and computers if you copy the private key (don't!). But that's not a good practice, security wise.

I'll to explain the process in simple terms.

  1. Generate key pair on the client computer, where you'll execute the ssh command; by the user you want to use to ssh. Not necessarily need to be generated there (or by a certain user), but it's simpler that way.
  2. Copy the public key only you generated to the computer you want to connect through ssh and to the user of that computer. ssh-copy-id essentially does something like this:
cat ~/.ssh/id_rsa.pub | ssh user@computer 'cat >> ~/.ssh/authorized_keys'

Have in mind that you can arbitrarily connect from any user@computer1 to any user@computer2. No need to connect root to root for example. Crucial point, copy or transfer with whichever method the public key only. The private key must not be transfered, copied or gained access by someone you don't want to.

I used the term computer instead of client/server because most Linux systems have sshd (server) and ssh (client) installed by default nowadays. So you can use ssh to connect and administer from server to server, or even from a server to a client.

Krackout
  • 1,575
  • 7
  • 20