尝试将 SSH 密钥复制到远程服务器时收到以下错误消息:
ssh-copy-id -p*** ****@****.com
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh: Could not resolve hostname umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorec: Name or service not known
将命令更改为:
ssh-copy-id -T -p*** ****@****.com
将错误更改为:
ssh: Could not resolve hostname umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorec: Name or service not known
此命令在网络上的其他计算机上也可以正常运行。
答案1
通过将主机添加到您的(您可能无论如何都会需要长期使用它)来避免-p
在(某些版本)中使用时出现的问题:ssh-copy-id
~/.ssh_config
Host ****@****.com
Port ***
现在ssh-copy-id
不带-p
参数运行:
$ ssh-copy-id ****@****.com