winfsp / sshfs-win

SSHFS For Windows
https://winfsp.dev
Other
5.18k stars 263 forks source link

Connect to AWS without a password using RSA private key #153

Open dm222 opened 4 years ago

dm222 commented 4 years ago

I get an error while connecting Command on Windows: sshfs-win.exe svc \sshfs.k\ubuntu@11.222.333.44\C:\Users\test\.ssh\key.pem R:

Error: Warning: Permanently added '11.222.333.44' (ECDSA) to the list of known hosts. ubuntu@11.222.333.44: Permission denied (publickey). read: Connection reset by peer

If I connect via my Mac, then everything works great.

Thanks in advance

pabl-o-ce commented 4 years ago

yeah a finally give up..

if anyone can give some explanation with an example how make this.

I try this:

net use X: \\sshfs.k\username@ip

and put my key pem file in C:\Users\Administrator\.ssh\key.pem

but nada [nothing].

also try:

set PATH=C:\Program Files\SSHFS-Win\bin

sshfs-win.exe -o IdentityFile=C:\Users\Administrator\.ssh\key.pem uid=-1 username@ip:~ k:

give me no output and same nada [nothing]

If anyone with a good heart can help thanks

pabl-o-ce commented 4 years ago

Guys long story short:

End up using Wireguard and Samba

But if anyone want to explain using key with this method like to hear it.

with love ❤️ the Lannister send their regards.

tratzla commented 4 years ago

I solved this issue I was also having connecting to an AWS instance that is key only. Although for some reason it connected once with this command:

sshfs-win svc \sshfs.k\username@ip X: -oIdentityFile=C:\Users\Admin\.ssh\id_rsa

any subsequent attempts failed similar to others here (I added -odebug to get more output):

Warning: Permanently added 'ip' (ECDSA) to the list of known hosts.
no such identity: C:UsersAdmin.sshid_rsa: No such file or directory
username@ip: Permission denied (publickey).
read: Connection reset by pee

I noticed the slashes in the path were gone in the error so I started playing with that. It seems using forward slashes in the path of the key file solves the issue:

sshfs-win svc \sshfs.k\username@ip X: -oIdentityFile=C:/Users/Admin/.ssh/id_rsa

pabl-o-ce commented 4 years ago

@tratzla I Try your command but nada (nothing)

evsar3 commented 4 years ago

Hi, The response for this problem is clearly in @tratzla answer: The backslashes seems to need to be escaped.

Try using double backslash ( \\ ) instead of single forward slash. It worked for me: sshfs-win svc \sshfs.k\username@ip X: -oIdentityFile=C:\\Users\\Admin\\.ssh\\id_rsa

cedric-h commented 4 years ago

Just like the sshfs Linux utility, sshfs-win will still check for your ~/.ssh/config file. With this ~/.ssh/config file: (with the actual IP of my thing redacted)

Host ec2-RE-D-ACT-ED.compute-1.amazonaws.com
    IdentityFile ~/Documents/pem/key-download-from-amazon.pem

I was able to get this command to work: sshfs-win svc \sshfs.k\ubuntu@ec2-RE-D-ACT-ED.compute-1.amazonaws.com X:

RE-D-ACT-ED is the IP of my AWS EC2 server, starting with 52. I obtained that section by right clicking the instance in the Amazon EC2 console and selecting "Connect" and copying and pasting it from the SSH command AWS provides there.