[root@Applets .ssh]# ssh-copy-id -i id_rsa.pub "-p 65080 git@172.17.136.248" //不应该加引号的
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub"
Usage: /usr/bin/ssh-copy-id [-h|-?|-f|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname
-f: force mode -- copy keys without trying to check if they are already installed
-n: dry run -- no keys are actually copied
-h|-?: print this help
[root@Applets .ssh]# ssh-copy-id -i id_rsa.pub -p 65080 git@172.17.136.248 //正确命令
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
git@172.17.136.248's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -p '65080' 'git@172.17.136.248'"
and check to make sure that only the key(s) you wanted were added.
[root@Applets .ssh]# ssh -p 65080 git@172.17.136.248
Last login: Sun Aug 4 11:37:46 2019
Welcome to Alibaba Cloud Elastic Compute Service ! //免密登录成功
评论区