I installed an OpenSSH server on my Windows server. The new Windows "SSH server feature" did not appear at all (I tried it through the settings and the instructions form Microsoft to install it through the PowerShell), so I downloaded this one. I managed to set up public key authentication, so the local server user can log in using his key. This works well. I used the Process Explorer (sysinternals, see here) to set the permissions: The user is allowed to start and stop one specific service. When the user is logged in via SSH, calling "net start " returns "System error 5 has occurred. Access is denied."
What I tried: I found this error weird since I did set the permissions. So I logged in to the server with this same user via a Remote Desktop Connection. In the regular (non-admin) command prompt, I again called "net start " and it worked!
I also tried to temporarily add the local server user to the admin group of the server. UPDATE: When I do that, I can start the service via SSH. But when the user is not part of the admin group, I can still only start the service in the remote desktop connection session, not via ssh.
I don't know what the problem is, it might be connected to the SSH server not handling the permissions correctly. I'm pretty desperate already, so I'd be VERY grateful for some help! :D
whoami
command if it exists in Server 2016 or by Process Explorer. If required, there exist methods for a non-admin user to run specific commands as admin.