简体   繁体   中英

Can't connect to AWS EC2 server via vscode sftp extension on Ubuntu 22.04 OS

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文件样本

And the aws security setting is as following AWS 安全设置

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.

I searched the anwser on the inte.net 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM