Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 5 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

share|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
add comment

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.