線上服務器會對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.