今天,当我尝试在 macOS 13.4 中使用 ssh 将文件复制到 Ubuntu 22.04LTS 时,如下所示:
ssh -vvv -p 22 [email protected] 'mkdir -p .ssh && cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
显示错误:
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/xiaoqiangjiang/.ssh/id_ecdsa
debug3: no such identity: /Users/xiaoqiangjiang/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/xiaoqiangjiang/.ssh/id_ecdsa_sk
debug3: no such identity: /Users/xiaoqiangjiang/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /Users/xiaoqiangjiang/.ssh/id_ed25519
debug3: no such identity: /Users/xiaoqiangjiang/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /Users/xiaoqiangjiang/.ssh/id_ed25519_sk
debug3: no such identity: /Users/xiaoqiangjiang/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /Users/xiaoqiangjiang/.ssh/id_xmss
debug3: no such identity: /Users/xiaoqiangjiang/.ssh/id_xmss: No such file or directory
debug1: Trying private key: /Users/xiaoqiangjiang/.ssh/id_dsa
debug3: no such identity: /Users/xiaoqiangjiang/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).
看来 sshid_dsa
默认情况下会查找。我错过了什么吗?我应该怎么做才能解决这个问题?这个命令在过去很长一段时间内工作得很好。
答案1
ls /Users/xiaoqiangjiang/.ssh/
如果密钥文件不存在,则生成新的 SSH 密钥对