TigerVNC / tigervnc

High performance, multi-platform VNC client and server
https://tigervnc.org
GNU General Public License v2.0
5.07k stars 932 forks source link

"unable to start the service: Access is denied. (5)" trying to start service #252

Open genpfault opened 8 years ago

genpfault commented 8 years ago

tl;dr: Might want to modify the Windows installer to give "SYSTEM" read & execute permissions on winvnc4.exe. Or at least add this particular edge case to the wiki.

Windows 7 Home Premium, x64

http://tigervnc.bphinz.com/nightly/ tigervnc64-1.6.80.exe 655c8ce30571de20380aa05badc4b678

Installed to C:\Tools\VNC

In a "Run as administrator" cmd.exe:

winvnc4.exe -unregister
(no output)

winvnc4.exe -noconsole -start
(popup) unable to open the service: The specified service does not exist as an installed service. (1060)
(expected, I think)

winvnc4.exe -register
(no output)

winvnc4.exe -noconsole -start
(popup) unable to start the service: Access is denied. (5)

Looks like that's coming from here: https://github.com/TigerVNC/tigervnc/blob/master/win/rfb_win32/Service.cxx#L534

due to StartService() kicking back ERROR_ACCESS_DENIED.

At the bottom of Microsoft's StartService() docs "Tanuki Software" helpfully notes:

ERROR_ACCESS_DENIED will also be returned if the account (for instance 'SYSTEM'), under who the Service will be running, doesn't have Read & Execute file permission on the Service's executable file.

My local user account was the only thing on the winvnc4.exe ACL according to the "Security" tab on the properties dialog.

Added the "SYSTEM" user with the "Read & execute" and "Read" permissions set and the service started right up without complaint.

--- Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/28965347-unable-to-start-the-service-access-is-denied-5-trying-to-start-service?utm_campaign=plugin&utm_content=tracker%2F3557444&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3557444&utm_medium=issues&utm_source=github).
genpfault commented 8 years ago

The work-around works on the 1.6.0 beta too:

https://bintray.com/artifact/download/tigervnc/beta/tigervnc64-1.5.90.exe
sha1: a35013de7b014989e7a6666f08b0ddccbe5c659c
sha256: 6893aef6b4daebce66598604d89e21bf9ab329277ebccbf081b6960fcaf28970
genpfault commented 8 years ago

Maybe append ; Permissions: system-readexec to the Source entry for winvnc4.exe in tigervnc.iss.in?

(at least that's what I gathered from the Inno Setup [Files] section docs)

genpfault commented 8 years ago

Looks like vncconfig.exe needs the SYSTEM treatment too or else I can't get the Options panel to come up using the systray icon.

bphinz commented 8 years ago

Thanks for the info. I noted an issue with the tray icon in #234 as well, but it got lost in the shuffle.

CendioOssman commented 8 years ago

I'm not having any of these issues on 2008R2. Is this a problem specific to the workstation versions of Windows?

genpfault commented 8 years ago

I may have partitioned & formatted that drive using gparted instead of the partitioning/formatting wizard in the Windows 7 installer. Can't remember if the installer re-formats a NTFS partition before attempting to install or not.

It's possible that mkntfs didn't set the same default permissions and/or ACLs as the Windows 7 installer does.