edrich13
edrich13

Reputation: 829

adding ssh public key to server by another user

i have the permission to ssh into the server but i want to add another persons public key on to the server so that he can also ssh into the server how can i do that ... i tried using the following command

<entered another users public key> | ssh [email protected] "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

i get this error

 w: No such file or directory

but this command does not work fine for me... how can i do it ?

Upvotes: 1

Views: 868

Answers (1)

Jakuje
Jakuje

Reputation: 25966

You probably need echo:

echo "<entered another users public key>" \
    | ssh [email protected] "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

Upvotes: 2

Related Questions