[Hosting] Error when connecting via SFTP extension in VisualStudio

I’m using VisualStudio with a SFTP plugin for my development. It’s important for me to be able to use that plugin, as I can edit the files on the server directly without having to upload them each time.

My site is hosted with WPMU DEV. The plugin is giving me an error when I’m trying to connect: “All configured authentication methods failed” – this only happens if I set it to automatically provide the password. If I set it to ask for password each time I’m logging in, it works.

  • Ocean Diveloper
    • Site Builder, Child of Zeus

    As an addition I’d like to refer to a topic on Github about the same issue.

    The developer had this to say:

    Your ssh authentication failed. Check your sshd logs on your server. It has nothing to do with the extension.

    Another user says on the same thread that he solved it like this:

    Made modification in the server sshd config file /etc/ssh/sshd_config as below and it started working

    KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

    Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr,aes192-cbc,aes256-cbc,arcfour

    I hope that any of this helps :slight_smile:

  • Adam
    • Support Gorilla

    Hi Ocean Diveloper

    I hope you’re well today and thank you for your question!

    I tested it with the same extension in VisualStudio Code and using SFTP account auth set to regular username and password (instead of key file) and following SFTP extension (sftp.json) config

    "name": "My Server",
    "host": "something.wpmudev.host",
    "protocol": "sftp",
    "port": 22,
    "username": "myusername",
    "password": "mypassword",
    "passive": false,
    "interactiveAuth": true,
    "remotePath": "/",
    "uploadOnSave": true

    this works fine on my end, connecting “transparently” to the server without me having to manually put the password for each connection. There must however be both “interactiveAuth” set to true and password specified in the file.

    Can you give it another try, please, with just that kind of minimal config as above (note: please replace host, username and password info with your own)?

    Best regards,

    Adam

  • Ocean Diveloper
    • Site Builder, Child of Zeus

    Hi Adam,

    I’ve tried it again and with the config you provided I still get asked for the password (see attached video). What am I missing here?

    [08-10 12:16:19] [info] config at /Users/kiudex/PROJECTS/Ocean Diveloper/oceandiveloper.com/theme/oceandiveloper-2019 {"remotePath":"/","uploadOnSave":true,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":true,"secure":false,"remoteTimeOffsetInHours":0,"name":"Ocean Diveloper PROD","host":"oceandiveloper.wpmudev.host","port":22,"username":"******","password":"******","passive":false}
    [08-10 12:16:57] [warn] ENOENT: no such file or directory, open '/Users/kiudex/.ssh/config' load /Users/kiudex/.ssh/config failed

  • Adam
    • Support Gorilla

    Hi Ocean Diveloper

    Thank you for your response!

    You’re right. I’m not using Visual Studio often and apparently I didn’t test it properly.

    However, I just did more testing and with a small change to the configuration that I shared previously it works every time for me, without any issues. I changed one option, setting “passive” mode this line in my config is now:

    "passive": true,
    "interactiveAuth": false,

    Try setting them like this, keeping the rest of the setup intact. I’m not sure why, but I actually had to restart entire program after that change to take effect (even though it’s not supposed to be required).

    After that I was asked for password only once – first time – and all the further operations on this project (I tried “Upload”, “Download”, “Sync Local -> Remote”, “Sync Remote -> Local”, multiple times) worked flawlessly without asking me for credentials any more.

    I must honestly say that if this still doesn’t work for you like that, I’m not really sure what might be causing this so you might need to ask extension developers for assistance again as they might be able to suggest what’s wrong based on some logs.

    As for why it still asks for password at first connection – I found this information:

    Note that here you don’t need to enter your password. Extension prompt for password first time when we perform the operation and it is a one-time process.

    here:

    https://artisansweb.net/ftp-sftp-extension-for-visual-studio-code/

    Best regards,

    Adam