webmstrssh 鍵認証にはまだパスワードが必要です。

webmstrssh 鍵認証にはまだパスワードが必要です。

こんにちは、私はサーバー間でパスワードのないSSH接続を作成しています。 keygenを介してキーを生成し、以下を介してリモートサーバーにコピーしました。

ssh-copy-id -i id_rsa.pub [email protected]

ローカルシステム

-bash-4.2$ ls -la
total 24
drwx------. 2 webmstr webmstr  108 Aug 27 09:25 .
drwxr-xr-x. 4 webmstr webmstr 4096 Aug 26 15:26 ..
-rw-------. 1 webmstr webmstr 1202 Aug 25 10:43 authorized_keys
-rw-------. 1 webmstr webmstr 1679 Dec 15  2020 id_rsa
-rw-r--r--. 1 webmstr webmstr  411 Dec 15  2020 id_rsa.pub
-rw-r--r--. 1 webmstr webmstr 2609 Aug 25 13:19 known_hosts
-rw-r--r--. 1 webmstr webmstr 1211 Jun 30 10:13 known_hosts_06292021
-bash-4.2$ ssh-copy-id -i id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

-bash-4.2$

パスワードを求めるのにログインしようとすると、引き続きプロンプトが表示されます。

権限について読み、ホームディレクトリが700、.sshが700、認証キーが600であることを確認しましたが、まだパスワードプロンプトが表示されます。

リモートシステム(権限):

[webmstr@ups-rhelmxi-14 home]$ ls -ld webmstr/
drwx------. 7 webmstr webmstr 4096 Aug 26 17:00 webmstr/
[webmstr@ups-rhelmxi-14 home]$ cd webmstr/
[webmstr@ups-rhelmxi-14 ~]$ ls -lad .ssh
drwx------. 2 webmstr webmstr 98 Aug 27 07:40 .ssh
[webmstr@ups-rhelmxi-14 ~]$ cd .ssh
[webmstr@ups-rhelmxi-14 .ssh]$ ls -la
total 20
drwx------. 2 webmstr webmstr   98 Aug 27 07:40 .
drwx------. 7 webmstr webmstr 4096 Aug 26 17:00 ..
-rw-------. 1 webmstr webmstr 1803 Aug 27 09:25 authorized_keys
-rw-------. 1 webmstr webmstr 3102 Aug 26 16:23 authorized_keys_old
-rw-r--r--. 1 webmstr webmstr  349 Aug 27 07:43 known_hosts
-rw-r--r--. 1 webmstr webmstr  348 Aug 26 17:00 known_hosts_old
[webmstr@ups-rhelmxi-14 .ssh]$

キーを何度も追加しようとしました。

ローカルシステムからリモートシステム192.168.1.241への詳細なSSH接続を作成するとき:

  -bash-4.2$ ssh [email protected] -vv
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 59: Applying options for *
debug2: resolving "192.168.1.241" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.1.241 [192.168.1.241] port 22.
debug1: Connection established.
debug1: identity file /home/webmstr/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/webmstr/.ssh/id_ed25519-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 OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.1.241:22 as 'webmstr'
debug1: SSH2_MSG_KEXINIT sent
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],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss
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: 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
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-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]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HmLSkqaa9vDZQ85Yl/zv14Rk9/KVp/jsm4jiUMxUa2c
debug1: Host '192.168.1.241' is known and matches the ECDSA host key.
debug1: Found key in /home/webmstr/.ssh/known_hosts:4
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /home/webmstr/.ssh/id_rsa (0x55f4c98aba00)
debug2: key: /home/webmstr/.ssh/id_dsa ((nil))
debug2: key: /home/webmstr/.ssh/id_ecdsa ((nil))
debug2: key: /home/webmstr/.ssh/id_ed25519 ((nil))
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug2: we did not send a packet, disable method
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:1001)

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:1001)

debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/webmstr/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/webmstr/.ssh/id_dsa
debug1: Trying private key: /home/webmstr/.ssh/id_ecdsa
debug1: Trying private key: /home/webmstr/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
[email protected]'s password:

リモートwebmstrホームディレクトリの権限を更新しました。

[webmstr@ups-rhelmxi-14 home]$ ls -la
total 8
drwxr-xr-x.  4 root          root            42 Apr  2  2020 .
dr-xr-xr-x. 18 root          root           239 Jan  6  2021 ..
drwxr-xr-x.  5 administrator administrator 4096 Aug 13 16:06 administrator
drwxr-x---.  7 webmstr       webmstr       4096 Aug 27 10:27 webmstr
[webmstr@ups-rhelmxi-14 home]$

ソースサーバーで試してみるとき:

[dba@TS-MXIAppMon .ssh]$ ssh '[email protected]'
[email protected]'s password:

関連情報