2017-04-11 137 views
0

我有權SSH服務器,但我想添加另一個人的公共密鑰到服務器,以便他也可以ssh進入服務器我該怎麼做.. 。我嘗試使用以下命令由另一個用戶添加ssh公鑰到服務器

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

我得到這個錯誤

w: No such file or directory 

,但該命令不爲我工作得很好......我該怎麼辦呢?

回答

1

你可能需要echo

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

謝謝...它工作正常 – edrich13