2

This might seem a little confusing, but I have a server I want to SSH into but the password is kinda long and complex, I understand for security I shouldn't save my password in plain text but for my convenience, I'm not too worried. Regardless, I'm trying to make it so I can just start up a Linux distro in WSL that automatically connects me to my SSH server and logs in but I'm having trouble. My settings.json block looks kinda like:

            {
                "guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
                "hidden": false,
                "name": "SSH",
                "source": "Windows.Terminal.Wsl",
                "commandline": "/usr/bin/sshpass -p 'password' ssh -o StrictHostKeyChecking=no user@host"
            },

then when I start that distro I get:

[error 0x80070002 when launching `/usr/bin/sshpass -p 'password' ssh -o StrictHostKeyChecking=no user@host']

Is there another way to do this? And yes I have sshpass installed on literally all my distros just to be 100% sure. I googled around for an sshpass Windows version but can't find it. I've also tried just using sshpass instead of /usr/bin/sshpass but it doesn't work either.

As far as I know error 0x80070002 is a file not found error, but I don't know where the command isn't being found. Does the "commandline" setting get loaded before even the Linux Kernel? Is there a way to launch the command AFTER Linux initializes?

1 Answer 1

0

Like the picture below, you should add the fingerprint to the .ssh/known_hosts file first.

enter image description here

Then add sshpass command line to the Window Termial settings.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.