没有身份验证的 ssh-copy-id

Pre*_*rem 5 ssh security

Linux 服务器如何允许任何人在没有身份验证的情况下使用 ssh-copy-id 复制字符串(公钥)?它不会允许未知用户将任何恶意文件复制到服务器上吗?

Per*_*uck 13

ssh-copy-id 只是自动化命令

scp .ssh/id_rsa.pub user@other-host:
ssh user@other-host 'cat id_rsa.pub >> .ssh/authorized_keys'
ssh user@other-host 'rm id_rsa.pub'
Run Code Online (Sandbox Code Playgroud)

即:它将您的本地id_rsa.pub文件复制到另一台服务器并将其附加到远程用户的authorized_keys文件中。

它只是一个方便的脚本,它需要身份验证。您必须提供user的密码 (at other-host) 才能工作。ssh-copy-id除了代表您之外不做任何其他事情scp,因此如果他们需要密码身份验证,他们也会这样做。ssh ssh-copy-id