ssh 公钥问题:/usr/bin/ssh-copy-id:错误:找不到身份

1 server ssh security remote-access remote

我有两个用户,每个用户都有自己的运行 Ubuntu 的计算机。我想从其中一台(比如桌面服务器)远程访问另一台(比如客户端电脑)。
我正在尝试按照此答案中的相关部分启用基于公钥的身份验证(在家庭 LAN 中使用 SSH 连接两台计算机)。我从客户端电脑的命令开始

ssh-keygen -t rsa -b 4096
Run Code Online (Sandbox Code Playgroud)

设置保存密钥和密码的文件后,我启动以下命令:

ssh-copy-id emanuele@emanuele-desktop.local
Run Code Online (Sandbox Code Playgroud)

其中 emanuele@emanuele-desktop 是我想要远程访问的桌面服务器的 user@comp

/usr/bin/ssh-copy-id: ERROR: No identities found
Run Code Online (Sandbox Code Playgroud)

知道我缺少什么吗?

ste*_*ver 5

ssh-copy-id期望用户的公钥文件位于~/.ssh- 具体来说:

\n
\n
 The default_ID_file is the most recent file that matches: ~/.ssh/id*.pub,\n (excluding those that match ~/.ssh/*-cert.pub) so if you create a key\n that is not the one you want ssh-copy-id to use, just use touch(1) on\n your preferred key's .pub file to reinstate it as the most recent.\n
Run Code Online (Sandbox Code Playgroud)\n
\n

相应地,这就是ssh-keygen默认写入生成密钥的位置 - 如果您在运行时选择了非默认文件位置ssh-keygen,那么您可以ssh-copy-id使用以下-i选项指定该位置:

\n
\n
 -i identity_file\n         Use only the key(s) contained in identity_file (rather than look\xe2\x80\x90\n         ing for identities via ssh-add(1) or in the default_ID_file).  If\n         the filename does not end in .pub this is added.  If the filename\n         is omitted, the default_ID_file is used.\n
Run Code Online (Sandbox Code Playgroud)\n
\n