teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

5

パスの記載間違いを修正

2018/11/09 08:36

投稿

310uk
310uk

スコア13

title CHANGED
File without changes
body CHANGED
@@ -32,7 +32,7 @@
32
32
  ssh-keygen -t rsa
33
33
 
34
34
  #鍵を転送
35
- ssh-copy-id -i /home/hoge/.ssh/id_rsa.pub hoge@localhost
35
+ ssh-copy-id -i /var/hoge/.ssh/id_rsa.pub hoge@localhost
36
36
 
37
37
  #繋ぐとパスワードが求められてしまう
38
38
  ssh hoge@localhost
@@ -44,7 +44,7 @@
44
44
  ・127.0.0.1
45
45
  ・hostsに書いたホスト名
46
46
  ・ネットワーク上のIPアドレス
47
- - `/home/hoge/.ssh/`配下の`authorized_keys`と`known_hosts`の各ファイルの内容を確認したところ、正しいと思える内容が追記されていました。
47
+ - `/var/hoge/.ssh/`配下の`authorized_keys`と`known_hosts`の各ファイルの内容を確認したところ、正しいと思える内容が追記されていました。
48
48
  ※4つのサーバ指定が全て記載されていた
49
49
  - ググっていたところ(teratail内にもありましたが)ホームディレクトリや`.ssh`ディレクトリおよび配下のファイルのアクセス権設定が不適切な可能性、という話が見つかったので、正常に動作している稼働環境のアクセス権と同一に設定し直しましたが、状況は変わりませんでした。
50
50
  ※補足情報参照

4

sshをデバッグモードで実行した際の出力を追記しました。

2018/11/09 08:36

投稿

310uk
310uk

スコア13

title CHANGED
File without changes
body CHANGED
@@ -73,6 +73,65 @@
73
73
  Nov 9 16:01:59 backup-t su: pam_unix(su-l:session): session closed for user hoge
74
74
  ```
75
75
 
76
+ - `ssh`コマンドに`-v`スイッチを付けてデバッグモードで実行してみました。
77
+ しかし何故パスワード認証に移行してしまうのかが分かりません…
78
+ ```
79
+ [hoge@backup-t ~]$ ssh -v localhost
80
+ OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
81
+ debug1: Reading configuration data /etc/ssh/ssh_config
82
+ debug1: Applying options for *
83
+ debug1: Connecting to localhost [::1] port 22.
84
+ debug1: Connection established.
85
+ debug1: identity file /var/hoge/.ssh/identity type -1
86
+ debug1: identity file /var/hoge/.ssh/identity-cert type -1
87
+ debug1: identity file /var/hoge/.ssh/id_rsa type 1
88
+ debug1: identity file /var/hoge/.ssh/id_rsa-cert type -1
89
+ debug1: identity file /var/hoge/.ssh/id_dsa type -1
90
+ debug1: identity file /var/hoge/.ssh/id_dsa-cert type -1
91
+ debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
92
+ debug1: match: OpenSSH_5.3 pat OpenSSH*
93
+ debug1: Enabling compatibility mode for protocol 2.0
94
+ debug1: Local version string SSH-2.0-OpenSSH_5.3
95
+ debug1: SSH2_MSG_KEXINIT sent
96
+ debug1: SSH2_MSG_KEXINIT received
97
+ debug1: kex: server->client aes128-ctr hmac-md5 none
98
+ debug1: kex: client->server aes128-ctr hmac-md5 none
99
+ debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
100
+ debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
101
+ debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
102
+ debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
103
+ debug1: Host 'localhost' is known and matches the RSA host key.
104
+ debug1: Found key in /var/hoge/.ssh/known_hosts:2
105
+ debug1: ssh_rsa_verify: signature correct
106
+ debug1: SSH2_MSG_NEWKEYS sent
107
+ debug1: expecting SSH2_MSG_NEWKEYS
108
+ debug1: SSH2_MSG_NEWKEYS received
109
+ debug1: SSH2_MSG_SERVICE_REQUEST sent
110
+ debug1: SSH2_MSG_SERVICE_ACCEPT received
111
+ debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
112
+ debug1: Next authentication method: gssapi-keyex
113
+ debug1: No valid Key exchange context
114
+ debug1: Next authentication method: gssapi-with-mic
115
+ debug1: Unspecified GSS failure. Minor code may provide more information
116
+ Credentials cache file '/tmp/krb5cc_500' not found
117
+
118
+ debug1: Unspecified GSS failure. Minor code may provide more information
119
+ Credentials cache file '/tmp/krb5cc_500' not found
120
+
121
+ debug1: Unspecified GSS failure. Minor code may provide more information
122
+
123
+
124
+ debug1: Unspecified GSS failure. Minor code may provide more information
125
+ Credentials cache file '/tmp/krb5cc_500' not found
126
+
127
+ debug1: Next authentication method: publickey
128
+ debug1: Trying private key: /var/hoge/.ssh/identity
129
+ debug1: Offering public key: /var/hoge/.ssh/id_rsa
130
+ debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
131
+ debug1: Trying private key: /var/hoge/.ssh/id_dsa
132
+ debug1: Next authentication method: password
133
+ ```
134
+
76
135
  ---
77
136
  恐れ入りますが、どなたかお知恵をお貸しいただければと思います。
78
137
  よろしくお願いいたします。

3

ログのファイル名を間違えました。あと試したことを追記しました。

2018/11/09 08:08

投稿

310uk
310uk

スコア13

title CHANGED
File without changes
body CHANGED
@@ -50,6 +50,7 @@
50
50
  ※補足情報参照
51
51
  - `/etc/ssh/sshd_config`の設定は、両環境共同一であることを確認済みです。
52
52
  ※`PermitRootLogin`を変更した以外はデフォルト
53
+ - あえて`/etc/ssh/sshd_config`の`RSAAuthentication`と`PubkeyAuthentication`を有効にして`yes`を指定してみましたが、ダメでした。
53
54
  - サーバの再起動もしました。変化ありません…
54
55
 
55
56
  ### 補足情報
@@ -61,7 +62,7 @@
61
62
  -rw-r--r-- 1 hoge hoge 3537 11月 9 10:36 2017 known_hosts
62
63
  ```
63
64
 
64
- - `/var/log/messages`の出力内容は以下の通りです。
65
+ - `/var/log/secure`の出力内容は以下の通りです。
65
66
  鍵見に行ってない…
66
67
  ```
67
68
  Nov 9 16:01:42 backup-t su: pam_unix(su-l:session): session opened for user hoge by root(uid=0)

2

messageログの出力内容を追記しました。

2018/11/09 07:28

投稿

310uk
310uk

スコア13

title CHANGED
File without changes
body CHANGED
@@ -53,7 +53,7 @@
53
53
  - サーバの再起動もしました。変化ありません…
54
54
 
55
55
  ### 補足情報
56
- `.ssh`ディレクトリ配下の各ファイルのアクセス権は以下の通りです。
56
+ - `.ssh`ディレクトリ配下の各ファイルのアクセス権は以下の通りです。
57
57
  ```
58
58
  -rw------- 1 hoge hoge 3906 11月 9 10:32 2018 authorized_keys
59
59
  -rw------- 1 hoge hoge 1675 11月 9 10:16 2018 id_rsa
@@ -61,6 +61,17 @@
61
61
  -rw-r--r-- 1 hoge hoge 3537 11月 9 10:36 2017 known_hosts
62
62
  ```
63
63
 
64
+ - `/var/log/messages`の出力内容は以下の通りです。
65
+ 鍵見に行ってない…
66
+ ```
67
+ Nov 9 16:01:42 backup-t su: pam_unix(su-l:session): session opened for user hoge by root(uid=0)
68
+ Nov 9 16:01:54 backup-t sshd[3512]: Accepted password for hoge from ::1 port 40532 ssh2
69
+ Nov 9 16:01:54 backup-t sshd[3512]: pam_unix(sshd:session): session opened for user hoge by (uid=0)
70
+ Nov 9 16:01:57 backup-t sshd[3516]: Received disconnect from ::1: 11: disconnected by user
71
+ Nov 9 16:01:57 backup-t sshd[3512]: pam_unix(sshd:session): session closed for user hoge
72
+ Nov 9 16:01:59 backup-t su: pam_unix(su-l:session): session closed for user hoge
73
+ ```
74
+
64
75
  ---
65
76
  恐れ入りますが、どなたかお知恵をお貸しいただければと思います。
66
77
  よろしくお願いいたします。

1

初心者マークを付け忘れました…

2018/11/09 07:09

投稿

310uk
310uk

スコア13

title CHANGED
File without changes
body CHANGED
File without changes