Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 11 down vote accepted

Taken from this page

  1. add "digest" attribute on your element in server.xml with a hash algorithm as value (possible values are for example md5, sha-1 or sha-256, where the latter is strongly recommended).
  3. You will get an output in the following form <YOUR_PASSWORD>:<ENCRYPTED_PASSWORD>
  4. Replace value of user's password attribute in your tomcat-users.xml to <ENCRYPTED_PASSWORD>
  5. restart tomcat

See also: 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

Your Answer


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.