Starting OpenSSH server in Windows with debug messages enabled (-d)
I have a very strange problem trying to make the OpenSSH server
that ships with Windows 10 working fine. Basically, if I start the service manually by running C:\Windows\System32\OpenSSH\sshd.exe
, everything works fine, but when I start the service through the Windows GUI or Start-service sshd
from Powershell, I am not able to connect (I get a publickey denied - I have disabled password logging in the configuration file, so the problem might be a permission issue when trying to read the authorized_keys
file). I would like to understand better what is going on by reading the debug messages of the sshd
daemon, i.e. what you get by starting manually with -d
, but even if I add the -d
option to the Windows GUI which allows to specify startup parameters for a service, I am not sure where I should be reading those messages (i.e. the event viewer does not contain those messages). It would be good if there was a way to add startup parameters to the Start-service sshd
powershell command and read those messages in the Powershell session... Any idea?
Solution 1:
The Windows OpenSSH server logs to the event log by default. You should look in the Event Log Viewer under Applications and Services Logs -> OpenSSH. The Admin log shows errors, the Operational log shows Informational messages.
The OpenSSH logging is controlled by your C:\ProgramData\ssh\sshd_config file. The entry SyslogFacility determines the log location.
I got the answer from here: https://github.com/PowerShell/Win32-OpenSSH/wiki/Logging-Facilities.