On Ubuntu 10.04.3 LTS, after installing Tomcat 6, the way to add a manager / admin account is to add a record like this to /etc/tomcat6/tomcat-users.xml:

<role rolename="manager"/>
<role rolename="admin"/>
<user username="user" password="password" roles="manager,admin"/>

That password is in plaintext, and I'm not comfortable with that. Is there a way to use something like a hash instead? If you have a non-Ubuntu solution, I can probably translate it.

link|improve this question

75% accept rate
feedback

1 Answer

up vote 4 down vote accepted

Taken from this page

1) add "digest" attribute on your <Realm> element in server.xml with value "md5". For now it's strongly algorithm for password encoding in tomcat 
2) go to your CATALINA_HOME and run 
> java -cp lib/catalina.jar:bin/tomcat-juli.jar org.apache.catalina.realm.RealmBase -a md5 <YOUR_PASSWORD> 
You will get <YOUR_PASSWORD>:<ENCRYPTED_PASSWORD> 
3) replace value of user's "password" attribute in your tomcat-users.xml to <ENCRYPTED_PASSWORD> 
4) restart tomcat 

Tomcat digest password

link|improve this answer
+1, but eek at the MD5. Use "sha-1" or "sha-256", if it'll work. – Shane Madden Jul 29 '11 at 19:47
In Tomcat 7 there is now a digest.bat in the bin directory to do this. Example : digest.bat -a "md5" <YOUR_PASSWORD> – Zasz Aug 21 '11 at 18:45
feedback

Your Answer

 
or
required, but never shown

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