How to use SSHPass with WSL to autostart & login a session

1

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?

ssh
windows-subsystem-for-linux
sshpass
windows-terminal
asked on Stack Overflow Nov 29, 2020 by Kenneth Rhodes

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0