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

質問編集履歴

3

確認ポイントを追記

2018/06/11 10:22

投稿

ksilverwall
ksilverwall

スコア15

title CHANGED
File without changes
body CHANGED
@@ -118,9 +118,37 @@
118
118
  [ OK ]
119
119
  ```
120
120
 
121
+ ## 22番ポートの状態確認
122
+
123
+ Openしているようです。
124
+
125
+ ```
126
+ wsl@NP-143:/mnt/c/Users/kazuki_tsunemi$ nmap -p ssh localhost
127
+
128
+ Starting Nmap 7.01 ( https://nmap.org ) at 2018-06-11 19:19 DST
129
+ Problem binding to interface , errno: 92
130
+ socket_bindtodevice: Protocol not available
131
+ Problem binding to interface , errno: 92
132
+ socket_bindtodevice: Protocol not available
133
+ Problem binding to interface , errno: 92
134
+ socket_bindtodevice: Protocol not available
135
+ Problem binding to interface , errno: 92
136
+ socket_bindtodevice: Protocol not available
137
+ Problem binding to interface , errno: 92
138
+ socket_bindtodevice: Protocol not available
139
+ Nmap scan report for localhost (127.0.0.1)
140
+ Host is up (0.88s latency).
141
+ PORT STATE SERVICE
142
+ 22/tcp open ssh
143
+ ```
144
+
121
145
  ## 確認ポイント
122
146
 
123
147
  - `/etc/ssh/sshd_config` の `PasswordAuthentication yes` になっている
124
148
  - Windows側のFWは切っている
149
+ - ユーザーのパスワードは設定している
150
+ - sshサービスが設定後に再起動をしている
151
+ - 22ポートは開いている
125
152
 
153
+
126
154
  なにか思い当たる原因がありましたら教えてください。

2

エラーメッセージを追記

2018/06/11 10:22

投稿

ksilverwall
ksilverwall

スコア15

title CHANGED
File without changes
body CHANGED
@@ -1,3 +1,5 @@
1
+ ## 現象
2
+
1
3
  Windows Subsystem for LinuxにUbuntuを載せています。
2
4
  adminユーザーを作成し、SSH接続を行いましたが `Permission denied` と言われ接続できません。
3
5
 
@@ -7,7 +9,7 @@
7
9
  Permission denied, please try again.
8
10
  ```
9
11
 
10
- **sshd_config**
12
+ ## sshd_config
11
13
 
12
14
  ```
13
15
  # Package generated configuration file
@@ -100,8 +102,24 @@
100
102
  UsePAM yes
101
103
  ```
102
104
 
103
- **確認ポイント**
105
+ ## SSHD再起動時にメッセージ
104
106
 
107
+ ```
108
+ $ sudo /etc/init.d/ssh restart
109
+ [sudo] password for wsl:
110
+ Could not load host key: /etc/ssh/ssh_host_rsa_key
111
+ Could not load host key: /etc/ssh/ssh_host_dsa_key
112
+ Could not load host key: /etc/ssh/ssh_host_ecdsa_key
113
+ Could not load host key: /etc/ssh/ssh_host_ed25519_key
114
+ * Restarting OpenBSD Secure Shell server sshd Could not load host key: /etc/ssh/ssh_host_rsa_key
115
+ Could not load host key: /etc/ssh/ssh_host_dsa_key
116
+ Could not load host key: /etc/ssh/ssh_host_ecdsa_key
117
+ Could not load host key: /etc/ssh/ssh_host_ed25519_key
118
+ [ OK ]
119
+ ```
120
+
121
+ ## 確認ポイント
122
+
105
123
  - `/etc/ssh/sshd_config` の `PasswordAuthentication yes` になっている
106
124
  - Windows側のFWは切っている
107
125
 

1

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

2018/06/11 10:10

投稿

ksilverwall
ksilverwall

スコア15

title CHANGED
File without changes
body CHANGED
@@ -2,12 +2,106 @@
2
2
  adminユーザーを作成し、SSH接続を行いましたが `Permission denied` と言われ接続できません。
3
3
 
4
4
  ```
5
- # ssh localhost
5
+ $ ssh wsl@localhost
6
- root@localhost's password:
6
+ wsl@localhost's password:
7
7
  Permission denied, please try again.
8
8
  ```
9
9
 
10
+ **sshd_config**
11
+
12
+ ```
13
+ # Package generated configuration file
14
+ # See the sshd_config(5) manpage for details
15
+
16
+ # What ports, IPs and protocols we listen for
17
+ Port 22
18
+ # Use these options to restrict which interfaces/protocols sshd will bind to
19
+ #ListenAddress ::
20
+ #ListenAddress 0.0.0.0
21
+ Protocol 2
22
+ # HostKeys for protocol version 2
23
+ HostKey /etc/ssh/ssh_host_rsa_key
24
+ HostKey /etc/ssh/ssh_host_dsa_key
25
+ HostKey /etc/ssh/ssh_host_ecdsa_key
26
+ HostKey /etc/ssh/ssh_host_ed25519_key
27
+ #Privilege Separation is turned on for security
28
+ UsePrivilegeSeparation yes
29
+
30
+ # Lifetime and size of ephemeral version 1 server key
31
+ KeyRegenerationInterval 3600
32
+ ServerKeyBits 1024
33
+
34
+ # Logging
35
+ SyslogFacility AUTH
36
+ LogLevel INFO
37
+
38
+ # Authentication:
39
+ LoginGraceTime 120
40
+ PermitRootLogin prohibit-password
41
+ StrictModes yes
42
+
43
+ RSAAuthentication yes
44
+ PubkeyAuthentication yes
45
+ #AuthorizedKeysFile %h/.ssh/authorized_keys
46
+
47
+ # Don't read the user's ~/.rhosts and ~/.shosts files
48
+ IgnoreRhosts yes
49
+ # For this to work you will also need host keys in /etc/ssh_known_hosts
50
+ RhostsRSAAuthentication no
51
+ # similar for protocol version 2
52
+ HostbasedAuthentication no
53
+ # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
54
+ #IgnoreUserKnownHosts yes
55
+
56
+ # To enable empty passwords, change to yes (NOT RECOMMENDED)
57
+ PermitEmptyPasswords no
58
+
59
+ # Change to yes to enable challenge-response passwords (beware issues with
60
+ # some PAM modules and threads)
61
+ ChallengeResponseAuthentication no
62
+
63
+ # Change to no to disable tunnelled clear text passwords
64
+ PasswordAuthentication yes
65
+
66
+ # Kerberos options
67
+ #KerberosAuthentication no
68
+ #KerberosGetAFSToken no
69
+ #KerberosOrLocalPasswd yes
70
+ #KerberosTicketCleanup yes
71
+
72
+ # GSSAPI options
73
+ #GSSAPIAuthentication no
74
+ #GSSAPICleanupCredentials yes
75
+
76
+ X11Forwarding yes
77
+ X11DisplayOffset 10
78
+ PrintMotd no
79
+ PrintLastLog yes
80
+ TCPKeepAlive yes
81
+ #UseLogin no
82
+
83
+ #MaxStartups 10:30:60
84
+ #Banner /etc/issue.net
85
+
86
+ # Allow client to pass locale environment variables
87
+ AcceptEnv LANG LC_*
88
+
89
+ Subsystem sftp /usr/lib/openssh/sftp-server
90
+
91
+ # Set this to 'yes' to enable PAM authentication, account processing,
92
+ # and session processing. If this is enabled, PAM authentication will
93
+ # be allowed through the ChallengeResponseAuthentication and
94
+ # PasswordAuthentication. Depending on your PAM configuration,
95
+ # PAM authentication via ChallengeResponseAuthentication may bypass
96
+ # the setting of "PermitRootLogin without-password".
97
+ # If you just want the PAM account and session checks to run without
98
+ # PAM authentication, then enable this but set PasswordAuthentication
99
+ # and ChallengeResponseAuthentication to 'no'.
100
+ UsePAM yes
101
+ ```
102
+
10
- 確認ポイント
103
+ **確認ポイント**
104
+
11
105
  - `/etc/ssh/sshd_config` の `PasswordAuthentication yes` になっている
12
106
  - Windows側のFWは切っている
13
107