无需输入用户密码即可登录服务器

无需输入用户密码即可登录服务器

我想输入ssh-key的密码并进入服务器但现在我输入用户服务器的密码

我已使用 调整我的公钥以适应服务器ssh-copy-id,但仍然提示我输入密码。

客户:cat .ssh/config

Host alimd
    HostName srv1.mihandoost.com
    Port 22

Host *
    Compression yes
    User root
    HostKeyAlgorithms=+ssh-rsa
    IdentityFile ~/.ssh/id_rsa

服务器:cat /etc/ssh/sshd_config

PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
PermitRootLogin yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
PasswordAuthentication yes
KbdInteractiveAuthentication no
UsePAM yes
PrintMotd no
Subsystem       sftp    /usr/lib/ssh/sftp-server

客户:ssh -vvv [email protected]

debug1: load_hostkeys: fopen /home/njfamirm/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'srv1.mihandoost.com' is known and matches the ED25519 host key.
debug1: Found key in /home/njfamirm/.ssh/known_hosts:12
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: agent returned 1 keys
debug1: Will attempt key: /home/njfamirm/.ssh/id_rsa RSA SHA256:mvtTfk3TDAkKFPtV4ReA9pvcMwDLlkCU3RpqsPfu3SM explicit agent
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected]=<0>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/njfamirm/.ssh/id_rsa RSA SHA256:mvtTfk3TDAkKFPtV4ReA9pvcMwDLlkCU3RpqsPfu3SM explicit agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
[email protected]'s password:

谢谢!

相关内容