sshfs-win
sshfs-win copied to clipboard
UNC syntax to specify key?
I'm able to connect by mapping a network drive using UNC syntax.
I'm also able to connect using SSHF-Win Manager using a custom key location with the -oIdentityFile=
flag.
How can I use a custom key with UNC?
Looking at the UNC syntax, I don't see an option to specify a key:
\\sshfs.kr\[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
I'm aware of https://github.com/winfsp/sshfs-win/issues/231, but that seems to be for svc
Also related: https://github.com/winfsp/sshfs-win/issues/320 https://github.com/winfsp/sshfs-win/issues/323
Since I spend 2 days figuring it out ;), I will leave it here for future users:
A specific ssh private key can be specified by defining a new alias in the ssh config (file "C:\Users<user name>.ssh\config", containing something like the following:
Host <alias>
Hostname <actual name of HOST>
User <remoteServer user name(REMUSER)>
IdentityFile <path to private key>
IdentitiesOnly yes
BEWARE: sshfs-win can only use private keys WITHOUT passphrase, since the query for a passphrase can not be passed on to the user. BEWARE: sshfs-win does not use the built in openSSH client of windows, therefore stuff like Proxycommand is not used, only basics as far as I can tell.
Thanks for your post.
Do you know how to use that config file with UNC syntax?
\\sshfs.kr\[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
Thanks
Yes, you replace HOST with the new name
For example, if the following is the entry in your config file and your private key file is "C:\Users\userLocal.ssh\remoteServerKey"
Host remoteServer
Hostname remoteServer.example.com
User user1
IdentityFile C:\Users\userLocal\.ssh\remoteServerKey
IdentitiesOnly yes
Then you would specify that as "\sshfs.k\user1@remoteServer", port and remote path can be added as usual.
Thanks.
I saved the config file here: C:\Users\User\.ssh\config
Host user1_server
Hostname hostname.domain.com
User user1
IdentityFile C:\Users\User\.ssh\user1
IdentitiesOnly yes
I then attempt to map a new network drive in Windows Explorer: \\sshfs.kr\user1@user1_server!XXXX\path\
, but it fails.
Am I using wrong syntax somewhere?
The solution is here: https://github.com/winfsp/sshfs-win/issues/155#issuecomment-1316261288