使用下述ssh-copy-id命令把公钥密钥追加到远程主机 .ssh/authorized_key,可以实现免密码登陆。
ssh-copy-id -i ~/.ssh/id_rsa.pub "-p 59007 root@41.250.13.25"
有的使用会出现如下错误:
Usage: /usr/bin/ssh-copy-id [-h|-?|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname
解决办法:去掉上述代码中的双引号,即
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 59007 root@41.250.13.25
再次执行成功。
END
Last modification:May 23rd, 2020 at 07:50 am
© 允许规范转载
3 comments