VSCode SFTP plugin connecting with private key error:OPENSSL_internal:DECODE_ERROR

When I'm trying to upload file using SFTP extension in Visual Studio Code, following error is shown:

Full stack trace is

The ssh connection is using public key authentication, and my sftp configuration (sftp.json) is like following:


To fix this error, we can convert the private key file from OpenSSH private key format to PEM format.

Try again it will work now.


My cloud server moved to VPC from classic network just now, and connecting to it via SSH got following error



It seems the server host key is changed, one way to solve this prolem is to remove the line containing server IP address from /root/.ssh/known_hosts . Then connect to it by SSH again, it will ask you whether trust this new host key, like following message

Type yes and press Enter key, this new host key is added to .ssh/known_hosts  then.


Also you can obtain the host key from the remote server, and add it to .ssh/known_hosts  manually , but we won't cover this method in detail.