質問編集履歴

5

追記

2022/07/06 08:08

投稿

myao
myao

スコア116

test CHANGED
File without changes
test CHANGED
@@ -199,6 +199,32 @@
199
199
  └── known_hosts.old
200
200
  ```
201
201
 
202
+ **追記(3)**
203
+ ---
204
+ コマンドプロンプトは
205
+ ```ここに言語を入力
206
+ ssh -i 鍵 ubuntu@18.177.41.xxx -p 50022
207
+ ```
208
+ でポート指定のコードに変更したことによってssh接続することができました。
209
+
210
+ しかし、VSCodeでは変わらずポートを50022に指定したにもかかわらず、
211
+ 22ポートを接続することができないとエラーが返ってきます。
212
+ (サーバーの22ポートが閉じているため)
213
+
214
+ また、 id_rsa、id_ecdsa、id_ed25519 などが作成は
215
+ ```ここに言語を入力
216
+ sshd -t
217
+ ```
218
+ でこれらのファイルが無いため作成してくださいとエラーが返ってきたにもかからわず、
219
+
220
+ ```ここに言語を入力
221
+ ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
222
+ ```
223
+ などで作成してみると既に存在しますが上書きしますか?と返ってきました。
224
+
225
+ なお、上書きしてもsshフォルダ内にssh_host_rsa_key、/ssh_host_ecdsa_key、ssh_host_ed25519_keyは作成されていませんでした。
226
+ そのため、sshd -t では変わらずエラーが起こりました。
227
+
202
228
  **使用ツール**
203
229
  ---
204
230
  Windows 10 Home

4

追記

2022/07/06 07:47

投稿

myao
myao

スコア116

test CHANGED
File without changes
test CHANGED
@@ -72,6 +72,11 @@
72
72
 
73
73
  **該当のソースコード**
74
74
  ---
75
+ コマンドプロンプトでは下記の通りです。
76
+ ```ここに言語を入力
77
+ ssh -i 鍵 ubuntu@18.177.41.xxx
78
+ ```
79
+
75
80
  ~/.ssh/configは下記の通りです。
76
81
 
77
82
  ```ここに言語を入力

3

追記

2022/07/04 07:45

投稿

myao
myao

スコア116

test CHANGED
File without changes
test CHANGED
@@ -176,6 +176,24 @@
176
176
  UseDNS no
177
177
  ```
178
178
 
179
+ **追記(2)**
180
+ ---
181
+ **ディレクトリの構造**
182
+ ```ここに言語を入力
183
+ ubuntur───────ssh ─────sshd_cinfig
184
+ │ └─ sshd_config.old
185
+ │ └─ id_rsa.pub
186
+ │ └─ id_ecdsa
187
+ │ └─ id_ecdsa.pub
188
+ │ └─ id_ed25519
189
+ │ └─ id_ed25519.pub
190
+
191
+ └─ .ssh───────.authorized_keys.swp
192
+     ├──authorized_keys
193
+     ├──known_hosts
194
+ └── known_hosts.old
195
+ ```
196
+
179
197
  **使用ツール**
180
198
  ---
181
199
  Windows 10 Home

2

誤字

2022/07/03 12:24

投稿

myao
myao

スコア116

test CHANGED
File without changes
test CHANGED
@@ -91,7 +91,7 @@
91
91
  # What ports, IPs and protocols we listen for
92
92
  Port 50022
93
93
  # Use these options to restrict which interfaces/protocols sshd will bind to
94
- ListenAddress 18.177.41.249
94
+ ListenAddress 18.177.xx.xxx
95
95
  ListenAddress ::1
96
96
  Protocol 2
97
97
  HostKeys for protocol version 2

1

追記

2022/07/03 12:23

投稿

myao
myao

スコア116

test CHANGED
File without changes
test CHANGED
@@ -81,6 +81,100 @@
81
81
  Port 50022
82
82
  IdentityFile C:\Users\user\.ssh\秘密鍵
83
83
  ```
84
+ **追記**
85
+ ---
86
+ ssh/sshd_config の中身です。
87
+ ```ここに言語を入力
88
+ # Package generated configuration file
89
+ # See the sshd_config(5) manpage for details
90
+
91
+ # What ports, IPs and protocols we listen for
92
+ Port 50022
93
+ # Use these options to restrict which interfaces/protocols sshd will bind to
94
+ ListenAddress 18.177.41.249
95
+ ListenAddress ::1
96
+ Protocol 2
97
+ HostKeys for protocol version 2
98
+ #HostKey /etc/ssh/ssh_host_rsa_key
99
+ #HostKey /etc/ssh/ssh_host_ecdsa_key
100
+ #HostKey /etc/ssh/ssh_host_ed25519_key
101
+ #Privilege Separation is turned on for security
102
+ UsePrivilegeSeparation yes
103
+
104
+ # Lifetime and size of ephemeral version 1 server key
105
+ KeyRegenerationInterval 3600
106
+ ServerKeyBits 1024
107
+
108
+ # Logging
109
+ SyslogFacility AUTH
110
+ LogLevel INFO
111
+
112
+ # Authentication:
113
+ LoginGraceTime 120
114
+ PermitRootLogin no
115
+ StrictModes yes
116
+
117
+ RSAAuthentication yes
118
+ PubkeyAuthentication yes
119
+ #AuthorizedKeysFile %h/.ssh/authorized_keys
120
+
121
+ # Don't read the user's ~/.rhosts and ~/.shosts files
122
+ IgnoreRhosts yes
123
+ # For this to work you will also need host keys in /etc/ssh_known_hosts
124
+ RhostsRSAAuthentication no
125
+ # similar for protocol version 2
126
+ HostbasedAuthentication no
127
+ # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
128
+ #IgnoreUserKnownHosts yes
129
+
130
+ # To enable empty passwords, change to yes (NOT RECOMMENDED)
131
+ PermitEmptyPasswords no
132
+
133
+ # Change to yes to enable challenge-response passwords (beware issues with
134
+ # some PAM modules and threads)
135
+ ChallengeResponseAuthentication no
136
+
137
+ # Change to no to disable tunnelled clear text passwords
138
+ #PasswordAuthentication yes
139
+
140
+ # Kerberos options
141
+ #KerberosAuthentication no
142
+ #KerberosGetAFSToken no
143
+ #KerberosOrLocalPasswd yes
144
+ #KerberosTicketCleanup yes
145
+
146
+ # GSSAPI options
147
+ #GSSAPIAuthentication no
148
+ #GSSAPICleanupCredentials yes
149
+
150
+ X11Forwarding yes
151
+ X11DisplayOffset 10
152
+ PrintMotd no
153
+ PrintLastLog yes
154
+ TCPKeepAlive yes
155
+ #UseLogin no
156
+
157
+ #MaxStartups 10:30:60
158
+ #Banner /etc/issue.net
159
+
160
+ # Allow client to pass locale environment variables
161
+ #AcceptEnv LANG LC_*
162
+
163
+ Subsystem sftp /usr/lib/openssh/sftp-server
164
+
165
+ # Set this to 'yes' to enable PAM authentication, account processing,
166
+ # and session processing. If this is enabled, PAM authentication will
167
+ # be allowed through the ChallengeResponseAuthentication and
168
+ # PasswordAuthentication. Depending on your PAM configuration,
169
+ # PAM authentication via ChallengeResponseAuthentication may bypass
170
+ # the setting of "PermitRootLogin without-password".
171
+ # If you just want the PAM account and session checks to run without
172
+ # PAM authentication, then enable this but set PasswordAuthentication
173
+ # and ChallengeResponseAuthentication to 'no'.
174
+ UsePAM yes
175
+
176
+ UseDNS no
177
+ ```
84
178
 
85
179
  **使用ツール**
86
180
  ---