线上服务器会对ssh服务改为非22端口,这时候,在服务器之间创建双机互信的状况下,若使用ssh-copy-id命令,不通过特定的语法,会报错。服务器
[root@localhost ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub -p 10022 root@*.*.*.* Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorecon && /sbin/restorecon ~/.ssh ~/.ssh/authorized_keys >/dev/null 2>&1 || true)'
对于非22端口状况下的ssh-copy-id的使用,须要这样用:ssh
[root@localhost ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub '-p 20460 root@*.*.*.*' Now try logging into the machine, with "ssh '-p 10022 root@*.*.*.*'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.