Run Tomcat Service as Different User on Windows 7

1

1

I have installed Tomcat6 using the 32-bit/64-bit Windows Service Installer download version. In the setup instructions, it is recommended that "For optimal security, the service should be run as a separate user, with reduced permissions". I created a new local/standard user (Tomcat) to run the service. The Tomcat service is listed in my list of Services and it's running under my user profile. However, I can't figure out how to set/change which user to start it as.

sdoca

Posted 2011-06-24T22:13:35.423

Reputation: 606

Answers

2

Simply right click on Computer and click Manage.

Expand Services and Applications and double click on Tomcat (or whatever the service is called`.

From here, click the Log On tab, and click the Browse button, follows by the Advanced... button, then the Find Now button.

Select the user and close all back to the screen where you can type the password for the account. Type the password and click OK.

You may want to start/stop the service to test it works - if there are any problems, you can either check the event log, or it will probably give you instant feedback about the issue.

enter image description here

William Hilsum

Posted 2011-06-24T22:13:35.423

Reputation: 111 572

if anyone run into the problem of service not being started after changing user. Open Event Viewer and locate your error message, you might see "user require rights 'Log on as a service'". If so, run secpol.msc, go to Local Policies -> User Rights Assignment -> Log on as a service, add your user to the list and restart you tomcat service. https://saadsurya.wordpress.com/2020/02/21/run-tomcat7-service-with-different-account-than-local-system-account/

– Saad Surya – 2020-02-21T12:02:49.333

0

To reconfigure using the command line: sc config

sc.exe config "[servicename]" obj= "[.\username]" password= "[password]"

Mind the space after the equal sign.

leo

Posted 2011-06-24T22:13:35.423

Reputation: 600

In Windows 10, I found that the space didn't matter but the square brackets led to errors. I successfully used sc config MyServiceName obj=".\MyUsername" password="MyPassword" – M.M – 2017-11-14T00:16:11.260