当我从我的Mac12.6系统进入我的Ubuntu20.04.1系统时,每次都会提示我输入关键密码,但不知道如何去掉提示。下面是Ubuntu系统的输出,在这里,我在调试模式下手动运行sshd,但我对它显示的内容不太熟悉,无法确定出了什么问题。
root@dell:/etc/ssh# mkdir /var/run/sshd; chmod 0755 /var/run/sshd; /usr/sbin/sshd -d
debug1: sshd version OpenSSH_8.2, OpenSSL 1.1.1f 31 Mar 2020
debug1: private host key #0: ssh-rsa SHA256:Qi+QfQXlZMNzXx2rc4lTr8Sa2n8NzGShKKlFHlgIJT4
debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:XqYwNkxd/ELRRSp2tzfOAst5H+xwJUjZF95BfkCLIYk
debug1: private host key #2: ssh-ed25519 SHA256:wIWr6ju0DTop8DTREi+uJPxvHJvT+eJxXFq/jgMaJFU
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: sshd version OpenSSH_8.2, OpenSSL 1.1.1f 31 Mar 2020
debug1: private host key #0: ssh-rsa SHA256:Qi+QfQXlZMNzXx2rc4lTr8Sa2n8NzGShKKlFHlgIJT4
debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:XqYwNkxd/ELRRSp2tzfOAst5H+xwJUjZF95BfkCLIYk
debug1: private host key #2: ssh-ed25519 SHA256:wIWr6ju0DTop8DTREi+uJPxvHJvT+eJxXFq/jgMaJFU
debug1: inetd sockets after dupping: 3, 3
Connection from 192.168.1.9 port 63434 on 192.168.1.30 port 22 rdomain ""
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.6
debug1: match: OpenSSH_8.6 pat OpenSSH* compat 0x04000000
debug1: permanently_set_uid: 126/65534 [preauth]
debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: algorithm: curve25519-sha256 [preauth]
debug1: kex: host key algorithm: ssh-ed25519 [preauth]
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none [preauth]
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none [preauth]
debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
debug1: rekey out after 134217728 blocks [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: Sending SSH2_MSG_EXT_INFO [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: rekey in after 134217728 blocks [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user mth service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: PAM: initializing for "mth"
debug1: PAM: setting PAM_RHOST to "192.168.1.9"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user mth service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: userauth_pubkey: test pkalg rsa-sha2-512 pkblob RSA SHA256:OZm4uD0KuWx6Z494aecU2mD4GmWpmujCXaZkE+D2icY [preauth]
debug1: temporarily_use_uid: 1000/1000 (e=0/0)
debug1: trying public key file /home/mth/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: /home/mth/.ssh/authorized_keys:1: matching key found: RSA SHA256:OZm4uD0KuWx6Z494aecU2mD4GmWpmujCXaZkE+D2icY
debug1: /home/mth/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Accepted key RSA SHA256:OZm4uD0KuWx6Z494aecU2mD4GmWpmujCXaZkE+D2icY found at /home/mth/.ssh/authorized_keys:1
debug1: restore_uid: 0/0
Postponed publickey for mth from 192.168.1.9 port 63434 ssh2 [preauth]如果有任何提示,我将不胜感激。谢谢。
发布于 2022-10-18 18:34:52
这本身并不是一个问题--您的Mac系统上的私钥是由密码保护的,该私钥必须先被解锁,然后才能呈现给Ubuntu系统进行身份验证。
您有两个选项-第一个选项是使用ssh-agent和ssh-add将私钥解锁到内存代理中,使用该未锁定代理向Ubuntu系统显示您的身份。这是“更好”的选项,因为它留下了由密码保护的身份。我把引号写得更好,因为我觉得这更多地是关于这个选项是更好的,因为它保持密钥的安全还是更糟,因为它意味着每次启动系统时都需要处理代理的额外步骤。
$ eval `ssh-agent`
Agent pid 123456
$ ssh-add
Enter passphrase for /home/user/.ssh/id_rsa:每次运行eval命令时,上面的代理PID都会更改。标识文件将是您存储私有标识文件的位置,并且每次运行eval命令时都是相同的。
第二个选择是创建一个没有密码的新SSH密钥区,将新的公钥分发给您的Ubuntu系统,并使用不受保护的标识。
编辑:您还可以使用ssh-keygen -p从现有的键区删除密码,正如dave_thompson_085在评论中指出的那样。
https://unix.stackexchange.com/questions/721502
复制相似问题