質問編集履歴

3

確認ポイントを追記

2018/06/11 10:22

投稿

ksilverwall
ksilverwall

スコア15

test CHANGED
File without changes
test CHANGED
@@ -238,6 +238,54 @@
238
238
 
239
239
 
240
240
 
241
+ ## 22番ポートの状態確認
242
+
243
+
244
+
245
+ Openしているようです。
246
+
247
+
248
+
249
+ ```
250
+
251
+ wsl@NP-143:/mnt/c/Users/kazuki_tsunemi$ nmap -p ssh localhost
252
+
253
+
254
+
255
+ Starting Nmap 7.01 ( https://nmap.org ) at 2018-06-11 19:19 DST
256
+
257
+ Problem binding to interface , errno: 92
258
+
259
+ socket_bindtodevice: Protocol not available
260
+
261
+ Problem binding to interface , errno: 92
262
+
263
+ socket_bindtodevice: Protocol not available
264
+
265
+ Problem binding to interface , errno: 92
266
+
267
+ socket_bindtodevice: Protocol not available
268
+
269
+ Problem binding to interface , errno: 92
270
+
271
+ socket_bindtodevice: Protocol not available
272
+
273
+ Problem binding to interface , errno: 92
274
+
275
+ socket_bindtodevice: Protocol not available
276
+
277
+ Nmap scan report for localhost (127.0.0.1)
278
+
279
+ Host is up (0.88s latency).
280
+
281
+ PORT STATE SERVICE
282
+
283
+ 22/tcp open ssh
284
+
285
+ ```
286
+
287
+
288
+
241
289
  ## 確認ポイント
242
290
 
243
291
 
@@ -246,6 +294,14 @@
246
294
 
247
295
  - Windows側のFWは切っている
248
296
 
297
+ - ユーザーのパスワードは設定している
298
+
299
+ - sshサービスが設定後に再起動をしている
300
+
301
+ - 22ポートは開いている
302
+
303
+
304
+
249
305
 
250
306
 
251
307
  なにか思い当たる原因がありましたら教えてください。

2

エラーメッセージを追記

2018/06/11 10:22

投稿

ksilverwall
ksilverwall

スコア15

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,7 @@
1
+ ## 現象
2
+
3
+
4
+
1
5
  Windows Subsystem for LinuxにUbuntuを載せています。
2
6
 
3
7
  adminユーザーを作成し、SSH接続を行いましたが `Permission denied` と言われ接続できません。
@@ -16,7 +20,7 @@
16
20
 
17
21
 
18
22
 
19
- **sshd_config**
23
+ ## sshd_config
20
24
 
21
25
 
22
26
 
@@ -202,7 +206,39 @@
202
206
 
203
207
 
204
208
 
209
+ ## SSHD再起動時にメッセージ
210
+
211
+
212
+
213
+ ```
214
+
215
+ $ sudo /etc/init.d/ssh restart
216
+
217
+ [sudo] password for wsl:
218
+
219
+ Could not load host key: /etc/ssh/ssh_host_rsa_key
220
+
221
+ Could not load host key: /etc/ssh/ssh_host_dsa_key
222
+
223
+ Could not load host key: /etc/ssh/ssh_host_ecdsa_key
224
+
225
+ Could not load host key: /etc/ssh/ssh_host_ed25519_key
226
+
227
+ * Restarting OpenBSD Secure Shell server sshd Could not load host key: /etc/ssh/ssh_host_rsa_key
228
+
229
+ Could not load host key: /etc/ssh/ssh_host_dsa_key
230
+
231
+ Could not load host key: /etc/ssh/ssh_host_ecdsa_key
232
+
233
+ Could not load host key: /etc/ssh/ssh_host_ed25519_key
234
+
235
+ [ OK ]
236
+
237
+ ```
238
+
239
+
240
+
205
- **確認ポイント**
241
+ ## 確認ポイント
206
242
 
207
243
 
208
244
 

1

一般ユーザーを作り直してそちらで再試行しました。

2018/06/11 10:10

投稿

ksilverwall
ksilverwall

スコア15

test CHANGED
File without changes
test CHANGED
@@ -6,9 +6,9 @@
6
6
 
7
7
  ```
8
8
 
9
- # ssh localhost
9
+ $ ssh wsl@localhost
10
-
10
+
11
- root@localhost's password:
11
+ wsl@localhost's password:
12
12
 
13
13
  Permission denied, please try again.
14
14
 
@@ -16,7 +16,195 @@
16
16
 
17
17
 
18
18
 
19
+ **sshd_config**
20
+
21
+
22
+
23
+ ```
24
+
25
+ # Package generated configuration file
26
+
27
+ # See the sshd_config(5) manpage for details
28
+
29
+
30
+
31
+ # What ports, IPs and protocols we listen for
32
+
33
+ Port 22
34
+
35
+ # Use these options to restrict which interfaces/protocols sshd will bind to
36
+
37
+ #ListenAddress ::
38
+
39
+ #ListenAddress 0.0.0.0
40
+
41
+ Protocol 2
42
+
43
+ # HostKeys for protocol version 2
44
+
45
+ HostKey /etc/ssh/ssh_host_rsa_key
46
+
47
+ HostKey /etc/ssh/ssh_host_dsa_key
48
+
49
+ HostKey /etc/ssh/ssh_host_ecdsa_key
50
+
51
+ HostKey /etc/ssh/ssh_host_ed25519_key
52
+
53
+ #Privilege Separation is turned on for security
54
+
55
+ UsePrivilegeSeparation yes
56
+
57
+
58
+
59
+ # Lifetime and size of ephemeral version 1 server key
60
+
61
+ KeyRegenerationInterval 3600
62
+
63
+ ServerKeyBits 1024
64
+
65
+
66
+
67
+ # Logging
68
+
69
+ SyslogFacility AUTH
70
+
71
+ LogLevel INFO
72
+
73
+
74
+
75
+ # Authentication:
76
+
77
+ LoginGraceTime 120
78
+
79
+ PermitRootLogin prohibit-password
80
+
81
+ StrictModes yes
82
+
83
+
84
+
85
+ RSAAuthentication yes
86
+
87
+ PubkeyAuthentication yes
88
+
89
+ #AuthorizedKeysFile %h/.ssh/authorized_keys
90
+
91
+
92
+
93
+ # Don't read the user's ~/.rhosts and ~/.shosts files
94
+
95
+ IgnoreRhosts yes
96
+
97
+ # For this to work you will also need host keys in /etc/ssh_known_hosts
98
+
99
+ RhostsRSAAuthentication no
100
+
101
+ # similar for protocol version 2
102
+
103
+ HostbasedAuthentication no
104
+
105
+ # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
106
+
107
+ #IgnoreUserKnownHosts yes
108
+
109
+
110
+
111
+ # To enable empty passwords, change to yes (NOT RECOMMENDED)
112
+
113
+ PermitEmptyPasswords no
114
+
115
+
116
+
117
+ # Change to yes to enable challenge-response passwords (beware issues with
118
+
119
+ # some PAM modules and threads)
120
+
121
+ ChallengeResponseAuthentication no
122
+
123
+
124
+
125
+ # Change to no to disable tunnelled clear text passwords
126
+
127
+ PasswordAuthentication yes
128
+
129
+
130
+
131
+ # Kerberos options
132
+
133
+ #KerberosAuthentication no
134
+
135
+ #KerberosGetAFSToken no
136
+
137
+ #KerberosOrLocalPasswd yes
138
+
139
+ #KerberosTicketCleanup yes
140
+
141
+
142
+
143
+ # GSSAPI options
144
+
145
+ #GSSAPIAuthentication no
146
+
147
+ #GSSAPICleanupCredentials yes
148
+
149
+
150
+
151
+ X11Forwarding yes
152
+
153
+ X11DisplayOffset 10
154
+
155
+ PrintMotd no
156
+
157
+ PrintLastLog yes
158
+
159
+ TCPKeepAlive yes
160
+
161
+ #UseLogin no
162
+
163
+
164
+
165
+ #MaxStartups 10:30:60
166
+
167
+ #Banner /etc/issue.net
168
+
169
+
170
+
171
+ # Allow client to pass locale environment variables
172
+
173
+ AcceptEnv LANG LC_*
174
+
175
+
176
+
177
+ Subsystem sftp /usr/lib/openssh/sftp-server
178
+
179
+
180
+
181
+ # Set this to 'yes' to enable PAM authentication, account processing,
182
+
183
+ # and session processing. If this is enabled, PAM authentication will
184
+
185
+ # be allowed through the ChallengeResponseAuthentication and
186
+
187
+ # PasswordAuthentication. Depending on your PAM configuration,
188
+
189
+ # PAM authentication via ChallengeResponseAuthentication may bypass
190
+
191
+ # the setting of "PermitRootLogin without-password".
192
+
193
+ # If you just want the PAM account and session checks to run without
194
+
195
+ # PAM authentication, then enable this but set PasswordAuthentication
196
+
197
+ # and ChallengeResponseAuthentication to 'no'.
198
+
199
+ UsePAM yes
200
+
201
+ ```
202
+
203
+
204
+
19
- 確認ポイント
205
+ **確認ポイント**
206
+
207
+
20
208
 
21
209
  - `/etc/ssh/sshd_config` の `PasswordAuthentication yes` になっている
22
210