Ubuntu – The default password for the `tomcat7` user on the system

passwordtomcattomcat7users

I'm on Ubuntu 14.04 and I installed Apache Tomcat 7 via

sudo apt-get install tomcat7

and without editing any configuration I can start and stop the service tomcat7 successfully (localhost:8080 shows me the "It works!" page).

The installation seems to have created a user tomcat7 under which Tomcat runs. I would like to log in as that user (rather, switch to it using su tomcat7) but I don't know the password — yet I never configured one.

What is the password for user tomcat7?

Best Answer

Firstly, there should be zero reason to login as the tomcat7 user. There's no logical use case for this, so therefore I'm not sure why you'd try and use it.

You state in your question you want to set up a virtual X server for a webapp - you don't need to login as tomcat7 to do this, though your question isn't "How can I launch a virtual X server for my web app as tomcat7 without logging in", so don't expect help here with that in this question.

Having said this, it's likely that this is a System User Account and not an actual user; these users typically have no passwords associated with it, as it is designed to be used by system daemons and services, rather than users. Therefore, you cannot login as that user as it isn't designed to be logged into by users - to use the user, you have to use su to switch user to it, and you have to do so as superuser or root or with sudo. Also note that there's the option of setting a password, but it's ill-advised to do so, for that user.


Option 1 (Recommended, and the Proper Way to do this): su as sudo or root/superuser

You will need to have sudo power, or access to the root user to get this working with these instructions.

With sudo:

sudo su tomcat7

As root user:

su tomcat7

Option 2 (NOT RECOMMENDED, because it introduces security concerns and other issues): Set a password

You will need to have sudo power, or access to the root user to get this working with these instructions, and it is VERY likely you will break things by doing this. I HIGHLY RECOMMEND not doing this!

Set a password.

With sudo:

sudo passwd tomcat7
[set a password with the prompts]

As root:

passwd tomcat7

Once the password is set, then you can just login to the user (either via SSH or the console directly).

Again, I strongly recommend that you do not do this method - this could break Tomcat7, and can actually put your system at risk because someone can now brute-force the password and have access to the tomcat instance as the tomcat user itself.


To reiterate though: there is no logical reason to need to login as the tomcat7 user. Do so at your own risk as you can affect evilness on your system if you're not careful.