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

Can i open /etc/passwd file using an editor like vi and then add a comment into this file. If i am able to do that, will the change be persistent after reboot. If it is not the right way to edit the file in the above mentioned way, what is the ideal way to do this?


share|improve this question

You can edit the /etc/passwd file with a plain old text editor. However, it's advisable to use applications specifically designed for password file editing (vipw, useradd, etc...) as messing up this file can make it impossible to login normally. If you do mess up the file you will need to recover it by booting from a CD.

Once you edit the file, try logging in via "ssh localhost" or by using another virtual terminal ([ctrl] + [alt] + [F2]) before you logout of your existing session.

share|improve this answer

I don't think there is any way to leave a comment in the /etc/passwd file, except on FreeBSD systems using a '#' symbol. You can however use the following command to edit the passwd file using vi:

$ vipw
share|improve this answer
I dont have the command vipw in my linux machine. Is there any other method to edit it. – LinuxPenseur Jan 4 '11 at 5:24
What distribution is it? It might not be in your PATH shell variable. Try using this: /usr/sbin/vipw – atx Jan 4 '11 at 5:25

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.