suntobright / vscode-sftp

Edit remote Linux files directly in VS Code.
MIT License
14 stars 6 forks source link

Can not connect to AWS EC2 using SSH #4

Closed essentialskills closed 5 years ago

essentialskills commented 5 years ago

I am trying to connect to my Ubuntu EC2 using my private key (no password) but it just throws non stop errors every 5 seconds.

Watching ubuntu@(MYIPADDRESS):/home/ubuntu/projectfolder failed, Error: Connecting failed, Error: All configured authentication methods failed

My sftpConfig.json is

{
    "comment": "Test",
    "host": "(MYIPADDRESS)",
    "port": 22,
    "username": "ubuntu",
    "privateKeyFile": "C:\\credentials\\private.key"
}

The weird thing is that it allows me to navigate around my EC2 in order to pick a project folder? But once I choose a folder, it starts throwing authentication errors... How can it not authenticate when it's allowing me to navigate my EC2 folder structure to choose a folder?

Also, I can't find a way to unmount the workspace to stop the errors from just keep coming every five seconds. I tried sftp: Remove Configuration and rebooted VS Code but that didn't remove my workspace in Explorer so the errors still keep coming... How do you remove it?

Also, how do I make changes to the json config file later because my IP changes everytime I reboot the server?

suntobright commented 5 years ago

I'm sorry for your trouble.

The weird thing is that it allows me to navigate around my EC2 in order to pick a project folder? But once I choose a folder, it starts throwing authentication errors... How can it not authenticate when it's allowing me to navigate my EC2 folder structure to choose a folder?

If you could navigate your server and pick a folder, the connection configuration is right.

I do not familiar with EC2, so could you please check on the server security policy to confirm whether the server allow multiple connection, since the extension use a underlying connection pool to operate.

It looks much more like a bug in my code, and I will check on that.

Also, I can't find a way to unmount the workspace to stop the errors from just keep coming every five seconds. I tried sftp: Remove Configuration and rebooted VS Code but that didn't remove my workspace in Explorer so the errors still keep coming... How do you remove it?

The remote folder is just like a local folder, so you could use File -> Close Folder to close the remote folder just like the local ones.

Also, how do I make changes to the json config file later because my IP changes everytime I reboot the server?

Sorry, there is no such a way to edit a configuration later. This is designed for security. But I believe the EC2 could offer a domain name for your server because Azure does, and the domain name also works for the host field. And if you insist on using a IP address, you should remove the previous configuration and add a new one.

Sincerely thank you for your feedback.

suntobright commented 5 years ago

I've checked my code and confirm that it's a bug.

This issue should be resolved by #5.

I've release a hot fix release 1.1.1.

Please let me know if there is any issues.

Hope you enjoy my extension.

Thank you again for you feedback.

essentialskills commented 5 years ago

That worked perfectly thanks!

falcomsgy commented 5 years ago

Rapid response