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

Here is the question: I want user A to have the same password as user B. How to do that?

share|improve this question
Which OS? Any special authentication packages? – jscott Jun 12 '12 at 17:32
What are you trying to achieve here? Different users should have different passwords because that allows you to distinguish between them. If more than one user knows the password of a certain user you might as well use a single account. – Bram Jun 12 '12 at 18:24
It was an exam question dude. I know that it is not an honest real life situation. – alfish Jun 17 '12 at 10:30
up vote 4 down vote accepted

Change the /etc/shadow file, copy the hash from user B over the hash of user A. That's it :)

share|improve this answer
Caveat: Every user with root access can now KNOW the fact the passwords are the same without needing to try. This may or may not be a problem; password salting was invented for exactly that reason :) – rackandboneman Jun 12 '12 at 18:00
Caveat 2: whenever user A or B changes the password the paswords will not be in sync unless this procedure is repeated. I doubt the OP is looking for something to set the passwords equal just once. You might as well enter the same password twice. – Bram Jun 12 '12 at 18:23
@Bram: that would imply knowing user B's password ... – SamB Sep 2 '15 at 21:55

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.