SSHキーはパスワードを受け入れますが、パスワード認証を続けますか? (類似したサーバーペア間では発生せず、一対のサーバー間でのみ発生します)

SSHキーはパスワードを受け入れますが、パスワード認証を続けますか? (類似したサーバーペア間では発生せず、一対のサーバー間でのみ発生します)

私はこれについてしばらく頭を傷つけました。 SFTP用のSSHキーベース認証を設定する必要があります。そのため、パスワードを使用してキーファイルを生成し、公開鍵を別のベンダー(私が管理していないベンダー)に送信してAuthorized_keysファイルに追加しました。これを実行した後、次のコマンドを使用してサーバーにSFTPを試みました。

sftp -vvv -i /home/xxxuserxxx/.ssh/id_rsa xxxusernamexxx@their_server.org

結果は次のとおりです。

$ sftp -vvv -i /home/xxxuserxxx/.ssh/id_rsa xxxusernamexxx@their_server.org
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "their_server.org" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to their_server.org [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/xxxuserxxx/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxxuserxxx/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version 9.99 sshlib
debug1: no match: 9.99 sshlib
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to their_server.org:22 as 'xxxusernamexxx'
debug3: hostkeys_foreach: reading file "/home/xxxuserxxx/.ssh/known_hosts"
debug3: record_hostkey: found key type DSA in file /home/xxxuserxxx/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from their_server.org
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],ssh-dss
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c
debug2: host key algorithms: [email protected],ssh-dss,[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: host key algorithms: ssh-dss
debug2: ciphers ctos: aes256-ctr,twofish256-ctr,twofish-ctr,aes128-ctr,twofish128-ctr,3des-ctr,cast128-ctr,aes256-cbc,twofish256-cbc,twofish-cbc,aes128-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc,3des-cbc
debug2: ciphers stoc: aes256-ctr,twofish256-ctr,twofish-ctr,aes128-ctr,twofish128-ctr,3des-ctr,cast128-ctr,aes256-cbc,twofish256-cbc,twofish-cbc,aes128-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc,3des-cbc
debug2: MACs ctos: hmac-sha2-512,hmac-sha2-256,hmac-sha1
debug2: MACs stoc: hmac-sha2-512,hmac-sha2-256,hmac-sha1
debug2: compression ctos: zlib,none
debug2: compression stoc: zlib,none
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-dss
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: diffie-hellman-group-exchange-sha256 need=32 dh_need=32
debug1: kex: diffie-hellman-group-exchange-sha256 need=32 dh_need=32
debug3: send packet: type 34
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<8192<8192) sent
debug3: receive packet: type 31
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug2: bits set: 1036/2048
debug3: send packet: type 32
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug3: receive packet: type 33
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-dss SHA256:DB1GiNDCeVZBRU3rM8E3Igontk/9HetMfQ7fT9Trw1U
debug3: hostkeys_foreach: reading file "/home/xxxuserxxx/.ssh/known_hosts"
debug3: record_hostkey: found key type DSA in file /home/xxxuserxxx/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from their_server.org
debug3: hostkeys_foreach: reading file "/home/xxxuserxxx/.ssh/known_hosts"
debug3: record_hostkey: found key type DSA in file /home/xxxuserxxx/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from xxx.xxx.xxx.xxx
debug1: Host 'their_server.org' is known and matches the DSA host key.
debug1: Found key in /home/xxxuserxxx/.ssh/known_hosts:1
debug2: bits set: 1001/2048
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /home/xxxuserxxx/.ssh/id_rsa (0x563600ba8e40), explicit
debug3: send packet: type 5
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
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,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 RSA public key: /home/xxxuserxxx/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp SHA256:6n9VS4JyrsjyhbZ/fpLdQK7hizTdeABG0Lmo5Zp9j8k
debug3: sign_and_send_pubkey: RSA SHA256:6n9VS4JyrsjyhbZ/fpLdQK7hizTdeABG0Lmo5Zp9j8k
Enter passphrase for key '/home/xxxuserxxx/.ssh/id_rsa': 
<<<I entered the passphrase here>>>
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
xxxusernamexxx@their_server.org's password: 

理由を知らせずにパスワードをすべてスキップし、パスワード認証を行うことがわかります。その後、id_rsaファイルとid_rsa.pubファイルを別のサーバー、同じサブネット、および同じファイアウォールルールにコピーし、sftpプロセスが正しく機能しました。ユーザー名、ディレクトリ権限、およびsshd構成も同じです。出力は次のとおりです。

$ sftp -vvv -i /home/xxxuserxxx/.ssh/id_rsa xxxusername@their_server.org
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "their_server.org" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to their_server.org [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/xxxuserxxx/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxxuserxxx/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version 9.99 sshlib
debug1: no match: 9.99 sshlib
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to their_server.org:22 as 'xxxusernamexxx'
debug3: hostkeys_foreach: reading file "/home/xxxuserxxx/.ssh/known_hosts"
debug3: record_hostkey: found key type DSA in file /home/xxxuserxxx/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from their_server.org
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],ssh-dss
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c
debug2: host key algorithms: [email protected],ssh-dss,[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: host key algorithms: ssh-dss
debug2: ciphers ctos: aes256-ctr,twofish256-ctr,twofish-ctr,aes128-ctr,twofish128-ctr,3des-ctr,cast128-ctr,aes256-cbc,twofish256-cbc,twofish-cbc,aes128-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc,3des-cbc
debug2: ciphers stoc: aes256-ctr,twofish256-ctr,twofish-ctr,aes128-ctr,twofish128-ctr,3des-ctr,cast128-ctr,aes256-cbc,twofish256-cbc,twofish-cbc,aes128-cbc,twofish128-cbc,blowfish-cbc,cast128-cbc,3des-cbc
debug2: MACs ctos: hmac-sha2-512,hmac-sha2-256,hmac-sha1
debug2: MACs stoc: hmac-sha2-512,hmac-sha2-256,hmac-sha1
debug2: compression ctos: zlib,none
debug2: compression stoc: zlib,none
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-dss
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: diffie-hellman-group-exchange-sha256 need=32 dh_need=32
debug1: kex: diffie-hellman-group-exchange-sha256 need=32 dh_need=32
debug3: send packet: type 34
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<8192<8192) sent
debug3: receive packet: type 31
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug2: bits set: 1047/2048
debug3: send packet: type 32
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug3: receive packet: type 33
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-dss SHA256:DB1GiNDCeVZBRU3rM8E3Igontk/9HetMfQ7fT9Trw1U
debug3: hostkeys_foreach: reading file "/home/xxxuserxxx/.ssh/known_hosts"
debug3: record_hostkey: found key type DSA in file /home/xxxuserxxx/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from their_server.org
debug3: hostkeys_foreach: reading file "/home/xxxuserxxx/.ssh/known_hosts"
debug3: record_hostkey: found key type DSA in file /home/xxxuserxxx/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from xxx.xxx.xxx.xxx
debug1: Host 'their_server.org' is known and matches the DSA host key.
debug1: Found key in /home/xxxuserxxx/.ssh/known_hosts:2
debug2: bits set: 959/2048
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 4294967296 blocks
debug2: key: /home/xxxuserxxx/.ssh/id_rsa (0x55fe2bcde740), explicit
debug3: send packet: type 5
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
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,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 RSA public key: /home/xxxuserxxx/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp SHA256:6n9VS4JyrsjyhbZ/fpLdQK7hizTdeABG0Lmo5Zp9j8k
debug3: sign_and_send_pubkey: RSA SHA256:6n9VS4JyrsjyhbZ/fpLdQK7hizTdeABG0Lmo5Zp9j8k
Enter passphrase for key '/home/xxxuserxxx/.ssh/id_rsa': 
<<<I entered the passphrase here>>>
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to their_server.org ([xxx.xxx.xxx.xxx]:22).
debug2: fd 4 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 91
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env HOSTNAME
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env HISTSIZE
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env PWD
debug3: Ignored env JAVA_HOME
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env HISTCONTROL
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LOGNAME
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env OLDPWD
debug3: Ignored env _
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 16384 rmax 35840
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
debug2: Remote version: 3
Connected to their_server.org.
debug3: Sent message fd 3 T:16 I:1
debug3: SSH_FXP_REALPATH . -> /Home/xxxusernamexxx size 0
sftp> 

したがって、そのシステムで実行できます。また、ssh-keyを使用して私のサーバーから別のサーバー(xxxuserxxxを使用)にログインすることをテストしましたが、うまく機能していたので、私の側では設定しませんでした。これは私のサーバーとtheir_server.orgの間にのみ発生する問題のようです。ログにアクセスできず、会社はトラブルシューティングにあまり役に立ちません。新しいキーの生成を含め、私が考えることができるすべてを試しました。どんなアイデアでも役に立ちます!

ベストアンサー1

おすすめ記事