What is the default password for the `tomcat7` user on my system?
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 astomcat7
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.
Related videos on Youtube
Gerli
Updated on September 18, 2022Comments
-
Gerli over 1 year
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 usingsu tomcat7
) but I don't know the password -- yet I never configured one.What is the password for user
tomcat7
?-
Info-Screen over 8 yearsWhy doing this. There is no reason.
-
Thomas Ward over 8 years@DnrDevil I don't believe that's correct - the passwords are in
/etc/shadow
encoded/encrypted, and system users do not have passwords associated with them typically as they're not standard login accounts. -
Gerli over 8 years@Info-Screen, I need to set up a virtual X server for a webapp... this would be the easiest way to make sure that the display is owned by the correct user.
-
Info-Screen over 8 years@Gerli
chown
would work fine or just usesu
-
-
Info-Screen over 8 yearsthe Question was how to do it whitout
su
-
Thomas Ward over 8 years@Info-Screen they can't, that's the problem. There's no way to switch to the user without
su
, as system user accounts USUALLY do not have passwords so you can't direct-login as them anyways. -
Thomas Ward over 8 years@Info-Screen to actually state otherwise, nowhere does the user ask how to NOT need
su
to do this. They stated they would rather be able tosu
to it, if you read closely. -
Thomas Ward over 8 years@Gerli they're called 'system' accounts, and are usually used for system daemons (such as Apache or nginx which use
www-data
by default, or PostgreSQL db server, which usespostgres
, or MySQL which usesmysql
, etc.). They don't typically have passwords because only system daemons and services tend to use them... -
Gerli over 8 years
sudo su tomcat7
doesn't seem to make metomcat7
, though (andsudo su
+su tomcat
neither).whoami
still reports my own username... but I guess that's a new question. -
Thomas Ward over 8 years@Gerli
getent passwd tomcat7
. See if there's any output. If there is, then the user exists, but perhaps login is disabled completely (i.e./bin/false
for shell). If that's the case, then you can't sanely solve that - you shouldn't change the shell, and you shouldn't try and use that user.