我有权ssh进入服务器,但我想在服务器上添加其他人的公钥,这样他也可以ssh进入服务器,我该怎么做...我尝试使用以下命令
<entered another users public key> | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
我得到这个错误
w: No such file or directory
但是此命令对我来说不起作用...我该怎么办?
最佳答案
您可能需要echo
:
echo "<entered another users public key>" \
| ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
关于ssh - 由另一个用户向服务器添加ssh公钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43336715/