Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Tomcat 7 server running on Amazon EC2 (OS - Ubuntu 12 LTS). How can I find out which user is running Tomcat on Amazon EC2?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Run following command to find out the tomcat process

ps auxwww | grep -v grep | grep tomcat 

From there you will find out the tomcat process and from there you can see which user is starting this.

For eg see the following output

vidyadhar@ubuntu:~$ ps auxwww | grep -v grep | grep tomcat
root      1941  0.2  1.7 419224 35208 ?        Sl   Aug12   0:06 /usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

In above eg 1941 is a tomcat process which is started by root user.

If you want to see all the user run below command

more /etc/passwd
share|improve this answer
    
I recommend piping the output of ps ... to grep -v grep before piping to grep tomcat (rather than after). By piping to grep -v grep first, you see the helpful highlighting of the matching text, from the grep tomcat command (as only the last grep command's highlighting is retained). –  Eliah Kagan Aug 21 '12 at 7:30
    
@EliahKagan done the changes. Thanks –  Vidyadhar Sep 13 '12 at 12:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.