As known OpenSSH Server on Windows 10 (sshd.exe
) run as a service by default.
But there are cases that require to run OpenSHH Server in an interactive Windows session, not in session 0 by default. For example, let's assume you connect to Windows from some Linux/Android and you don't want to use Desktop connections like VNC and others. And then it's impossible to run the command such rundll32.exe user32.dll,LockWorkStation
via SSH successfully as LockWorkStation function requires Desktop session i.e. session 1, session 2, etc. And
Sometime ago I found a post stated that it's possible to run SHH Server on Windows interactively but no specific instructions were given then:
You can run the SSH server in an interactive Windows session, instead as a service. It has its limitations though.
Now I'm looking for those one.
I tried to run sshd.exe
directly through cmd
with configuration file and log like
c:\Windows\System32\OpenSSH\sshd.exe -f c:\Windows\System32\OpenSSH\sshd_config_default -E log.txt
but launched this way server doesn't support any incoming connection. The log file contains very little information:
Accepted password for The_Immortal from ::1 port 28532 ssh2
CreateProcessAsUserW failed error:1314
fork of unprivileged child failed
Unfortunately there is no proper help built in sshd.exe
. It only shows general list of arguments
usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]
[-E log_file] [-f config_file] [-g login_grace_time]
[-h host_key_file] [-o option] [-p port] [-u len]
And I'm frustrating what's necessary from this to finally run sshd.exe
interactively?
UPD: I've just found a big workaround similar to my question but it concerns some customized (upgraded) OpenSSH Server. Anyway with sshd -d
I have the same error as above.