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

質問編集履歴

1

詳細の追加

2020/05/01 05:52

投稿

ryu2142
ryu2142

スコア18

title CHANGED
File without changes
body CHANGED
@@ -41,4 +41,96 @@
41
41
  debug1: No more authentication methods to try.
42
42
  vpsuser@xxx.xx.xx.xx: Permission denied (publickey).
43
43
  me@MacBookAir ~ %
44
- ```
44
+ ```
45
+
46
+ 追記
47
+
48
+ > yukky1201様
49
+
50
+ サーバーへ公開鍵を登録した手順は、
51
+ 1.クライアントOS(Mac)でホームディレクトリに.sshディレクトリを作成
52
+ 2..sshディレクトリにてssh-keygenを実行しキーペアを作成
53
+ 3.サーバーOS(centOS)の一般ユーザー(vpsuser)のホームディレクトリに.sshディレクトリを作成
54
+ 4.クライアントOSからscpでid_rsa.pubをauthorized_keysという名前でサーバーOS側の.sshに転送
55
+ 5.必要なpermissionの設定をchmodで全て完了
56
+ という流れです。
57
+
58
+ > angel_p_57様
59
+
60
+ permission不備の確認のため、パスワード認証を有効にしssh -vでのログイン実行しました。
61
+ 以下のように表示されました。
62
+ ```ここに言語を入力
63
+ me@MacBookAir ~ % ssh -v vpsuser@xxx.xx.xx.xx
64
+ OpenSSH_8.1p1, LibreSSL 2.7.3
65
+ debug1: Reading configuration data /etc/ssh/ssh_config
66
+ debug1: /etc/ssh/ssh_config line 47: Applying options for *
67
+ debug1: Connecting to xxx.xx.xx.xx [xxx.xx.xx.xx] port 22.
68
+ debug1: Connection established.
69
+ debug1: identity file /Users/me/.ssh/id_rsa type 0
70
+ debug1: identity file /Users/me/.ssh/id_rsa-cert type -1
71
+ debug1: identity file /Users/me/.ssh/id_dsa type -1
72
+ debug1: identity file /Users/me/.ssh/id_dsa-cert type -1
73
+ debug1: identity file /Users/me/.ssh/id_ecdsa type -1
74
+ debug1: identity file /Users/me/.ssh/id_ecdsa-cert type -1
75
+ debug1: identity file /Users/me/.ssh/id_ed25519 type -1
76
+ debug1: identity file /Users/me/.ssh/id_ed25519-cert type -1
77
+ debug1: identity file /Users/me/.ssh/id_xmss type -1
78
+ debug1: identity file /Users/me/.ssh/id_xmss-cert type -1
79
+ debug1: Local version string SSH-2.0-OpenSSH_8.1
80
+ debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
81
+ debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
82
+ debug1: Authenticating to xxx.xx.xx.xx:22 as 'vpsuser'
83
+ debug1: SSH2_MSG_KEXINIT sent
84
+ debug1: SSH2_MSG_KEXINIT received
85
+ debug1: kex: algorithm: curve25519-sha256
86
+ debug1: kex: host key algorithm: ecdsa-sha2-nistp256
87
+ debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
88
+ debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
89
+ debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
90
+ debug1: Server host key: ecdsa-sha2-nistp256 SHA256:O5rjMSVgOtd9w9KDInCQPi2dE/SIczfZWci81fCeniQ
91
+ debug1: Host 'xxx.xx.xx.xx' is known and matches the ECDSA host key.
92
+ debug1: Found key in /Users/me/.ssh/known_hosts:1
93
+ debug1: rekey out after 134217728 blocks
94
+ debug1: SSH2_MSG_NEWKEYS sent
95
+ debug1: expecting SSH2_MSG_NEWKEYS
96
+ debug1: SSH2_MSG_NEWKEYS received
97
+ debug1: rekey in after 134217728 blocks
98
+ debug1: Will attempt key: /Users/me/.ssh/id_rsa RSA SHA256:UBU5Zm+lmOkiTOCYv4QxjDiZzkFmmVKLIvM6g9i3jVo
99
+ debug1: Will attempt key: /Users/me/.ssh/id_dsa
100
+ debug1: Will attempt key: /Users/me/.ssh/id_ecdsa
101
+ debug1: Will attempt key: /Users/me/.ssh/id_ed25519
102
+ debug1: Will attempt key: /Users/me/.ssh/id_xmss
103
+ debug1: SSH2_MSG_EXT_INFO received
104
+ debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
105
+ debug1: SSH2_MSG_SERVICE_ACCEPT received
106
+ debug1: Authentications that can continue: publickey,password
107
+ debug1: Next authentication method: publickey
108
+ debug1: Offering public key: /Users/me/.ssh/id_rsa RSA SHA256:UBU5Zm+lmOkiTOCYv4QxjDiZzkFmmVKLIvM6g9i3jVo
109
+ debug1: Authentications that can continue: publickey,password
110
+ debug1: Trying private key: /Users/me/.ssh/id_dsa
111
+ debug1: Trying private key: /Users/me/.ssh/id_ecdsa
112
+ debug1: Trying private key: /Users/me/.ssh/id_ed25519
113
+ debug1: Trying private key: /Users/me/.ssh/id_xmss
114
+ debug1: Next authentication method: password
115
+ vpsuser@xxx.xx.xx.xx's password:
116
+ debug1: Authentication succeeded (password).
117
+ Authenticated to xxx.xx.xx.xx ([xxx.xx.xx.xx]:22).
118
+ debug1: channel 0: new [client-session]
119
+ debug1: Requesting no-more-sessions@openssh.com
120
+ debug1: Entering interactive session.
121
+ debug1: pledge: network
122
+ debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
123
+ debug1: Remote: Ignored authorized keys: bad ownership or modes for directory /home/vpsuser/.ssh
124
+ debug1: Sending environment.
125
+ debug1: Sending env LANG = ja_JP.UTF-8
126
+ Last login: Fri May 1 14:26:51 2020 from softbank126147178223.bbtec.net
127
+
128
+ SAKURA Internet [Virtual Private Server SERVICE]
129
+
130
+ [vpsuser@tk2-212-15534 ~]$
131
+ ```
132
+
133
+ また、ssh-keygen -y -f ~/.ssh/id_rsa を実行して、id_rsa.pubファイルと内容が一致するかを確認しましたが、きちんと一致しておりました。
134
+ Match条件について確認しましたが、sshd_configを見る限りそれでは無さそうです、、。
135
+
136
+ どうぞよろしくお願いします。