2

I want to execute an sh script on a remote Windows 10 computer without logging into interactive shell.

On Linux I would do something like

ssh user@machine "echo execute program automatically && ./my_program "

However when I ssh into my Windows 10 machine using open-ssh server it opens by default cmd. In interactive mode I would now open git-bash

"C:\Program Files\Git\bin\sh.exe" --login

Then execute my script from there.

When I try to combine the commands like this

ssh user@machine ' "C:\Program Files\Git\bin\sh.exe" --login && ./my_program " '

the shell freezes. Without the single quotes, the command also doesn't work (obviously).

So what to do?

1 Answer 1

1

Try to change default shell, with administrator CMD :

reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d "C:\Program Files\Git\bin\sh.exe"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.