vscode-sftp icon indicating copy to clipboard operation
vscode-sftp copied to clipboard

sshConfigPath option doesn't pick up IdentifyFile from global Host entry

Open jarrah31 opened this issue 1 year ago • 0 comments

Do you read the FAQ?

  • [x] Yes.

Describe the bug I have multiple hosts in my .ssh/config file where almost all of them share a common IdentityFile, so I use Host * to set this as a global option so that I don't need to repeat this on each Host. e.g.

Host *
 StrictHostKeyChecking no
 IdentityFile ~/.ssh/test_id_rsa

Host test
 Hostname 192.168.1.32
 Port 22
 User pi

When I save a file, it prompts me for a password using this configuration because it doesn't know about the IdentifyFile.

My sftp.json looks like this:

{
    "name": "test HASS",
    "host": "test",
    "protocol": "sftp",
    "remotePath": "/home/pi/docker/homeassistant",
    "uploadOnSave": true,
    "useTempFile": false,
    "openSsh": false,
    "sshConfigPath": "~/.ssh/config"
}

If I include IdentifyFile within my Host config, it then works ok:

Host test
 Hostname 192.168.1.32
 IdentityFile ~/.ssh/test_id_rsa
 Port 22
 User pi

To Reproduce See above

Expected behavior Ideally I would like SFTP to use the native OpenSSH client so that it can use all .ssh/config features please. This would then allow me to use features such as ProxyJump and Match options. e.g.

Match exec "/Users/me/onsubnet 192.168.1." host dsrv2
 Hostname 192.168.1.32
 Port 22
 User pi

Match exec "/Users/me/onsubnet --not 192.168.1." host dsrv2
 ProxyJump mypi
 Hostname 192.168.1.32
 User pi
 Port 22

Host mypi
 HostName my domain.com
 Port 9999
 User pi

I currently use Sublime Text because the SFTP package available on there works with my config file, but ideally I'd rather use vscode as it's a much better development environment.

Desktop (please complete the following information):

  • OS: [Mac]
  • VSCode Version [1.82.0]
  • Extension Version [e.g. 1.16.3]

Extension Logs from Startup - required There's nothing useful from the debug logs to post because it immediately prompts for a password to which I then press escape to cancel.

jarrah31 avatar Sep 29 '23 18:09 jarrah31