0

Is it possible to create a UNIQUE key that can be used by all users to ssh to a server? I need to avoid creating a new key for each user and copying it to the server.

More in deep, I would create a key pair in a specific <key_path>, then copy the public key on the server and then let all the users ssh to the server just like this:

ssh -i <key_path> server-user@the-server

I tried to create a keypair with a specific user (call it userA) with no passphrase:

ssh-keygen -t rsa -f <key_path>

But when I try to use the userA's key with a different user (call it userB), I'm asked to enter the passphrase, even if there's no passphrase, and if I just press enter on the passphrase, I'm asked to insert the server-user password:

ssh -i <key_path> server-user@the-server
Enter passphrase for key <key_name>:
server-user@the-server's password:

I know I could generate a key for userA and another key for userB, but in my case I need to use the same key for different users.

spx305
  • 109
  • 2
  • 11
  • What does *UNIQUE* mean above? How exactly did you copy the public keys to the server? Appended to `~/.ssh/authorized_keys2` of each user? – domen Apr 20 '21 at 09:12
  • BTW, what are you trying to solve? Maybe there's a better solution than a shared key. – domen Apr 20 '21 at 09:12
  • Please note that Stack Overflow is for programming questions and not questions about using or setting up Linux. Please review [What topics can I ask here?](https://stackoverflow.com/help/on-topic) for more details. Question may be appropriate for [Super User](http://superuser.com) or [Unix & Linux](http://unix.stackexchange.com) but do check their help before posting. – kaylum Apr 20 '21 at 09:17
  • That being said, try "ssh -v" to receive some diagnostic output. Is your accessible to both users? Normally, ssh-keygen creates the key with mode 600. – JeffRSon Apr 20 '21 at 09:27

0 Answers0