ssh-copy-id 和 ssh- agent

看了半天也不知道这是什么鬼技巧, 大概就是说了一个问题, 然后怎样解决这个问题.

翻译模式开启:

如果没有-i的参数或者~/.ssh/identity.pub不可用, ssh-copy-id就会报错:

jsmith@local-host$ ssh-copy-id -i remote-host
/usr/bin/ssh-copy-id: ERROR: No identities found

如果你用ssh-add加载了公钥到ssh-agent的话, ssh-copy-id就会ssh-agent那里得到公钥并且拷贝到远程服务器.

jsmith@local-host$ ssh-agent $SHELL
jsmith@local-host$ ssh-add -L
The agent has no identities.
jsmith@local-host$ ssh-add
Identity added: /home/jsmith/.ssh/id_rsa
(/home/jsmith/.ssh/id_rsa)
jsmith@local-host$ ssh-add -L
ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQEAsJIEILxftj8aSxMa3d8t6JvM79D
aHrtPhTYpq7kIEMUNzApnyxsHpH1tQ/Ow==
/home/jsmith/.ssh/id_rsa
jsmith@local-host$ ssh-copy-id -i remote-host
jsmith@remote-host’s password:
Now try logging into the machine,
... ... ...

首先我们看到, ssh-add -L没有回显任何已有的公钥, 添加以后, 再用ssh-copy-id就可以以默认的公钥拷贝到远程主机上了.

也许作者在这里是想说明这几个软件之间的关系, 尽管有别的方法拷贝, 或者补全参数就能搞定.

(但我相信作者是在这里充数啊!!! -.-)

results matching ""

    No results matching ""