2

I used to connect remote servers provided by Linode and GCP and I use Visual Studio Code via Sftp extension and all works just fine. However, with the same set of configurations, I couldn't connect to my Aws EC2 server. The following is the sftp.json (with sensitive information changed)

json file sample

And the aws security setting is as following aws security settings

The strange thing is that I can ssh connect to the server on the terminal and I can use filezilla to send file with the same credential as well. But somehow I can't connect to it via Visual Studio Code sftp or SSH remote extension.

David Ko
  • 147
  • 8
  • Does this answer your question? [How to Connect EC2 Instance with VSCode Directly using pem file in SFTP](https://stackoverflow.com/questions/54402104/how-to-connect-ec2-instance-with-vscode-directly-using-pem-file-in-sftp) – Mate May 18 '22 at 04:34
  • @Mate Thank for the reply. Unfortunatily, It was not working. The result was still all configured authentication failed. – David Ko May 18 '22 at 05:30

1 Answers1

10

I searched the answer on the internet and found an answer that worked for me. The problem has to do with the Ubuntu 22.04 default server default key setting and not with the VSCode.

The solution is adding the following to: /etc/ssh/sshd_config:

PubkeyAcceptedKeyTypes=+ssh-rsa

in /etc/ssh/sshd_config

and then restart the service on the server with the following command

sudo systemctl restart sshd

The source of the answer comes from https://github.com/liximomo/vscode-sftp/issues/37 under the user windware-ono's answer.

Wayne Smallman
  • 1,690
  • 11
  • 34
  • 56
David Ko
  • 147
  • 8