I need to put one character inside the password file so that nobody can notice. I thought that if I was able to put the password as plain text and put something like a space nobody would ever find out. But I don't know how to put plain text in the /etc/passwd or /etc/shadow file. Is there any way to put just one character or a really short string in there so that if someone opens that file doesn't even notice that for instance gnats has a password.


gnats: :16273:0:99999:7:::



In short, no. The formats of these files are very specific, and the password field strings are hashes which will have a minimum length of 8 characters, 16 or more on more modern versions that use stronger password hashing. If you're looking for a way to just put in a text string, look at the gecos field in /etc/passwd. If you want a way to have an "invisible" password, you're out of luck in dealing with these two files.

  • Seems like my best way to do this is just remove the X in /etc/passwd and that way I will be able to just "su - user" and do my thing without typing any password. And it's the most unnoticeable thing that I've come up with in the last 5 minutes. – Hristina Mar 24 '15 at 17:50
  • 3
    You really do not want a user that someone is able to log in to without a password. Seriously, just don't do it. – John Mar 24 '15 at 17:57
  • @John Depends whether you're the attacker or the defender… – Gilles Mar 24 '15 at 23:41

To generate the encrypted password you can use the perl function

perl -e 'print crypt(" ","\$6\$saltsalt\$") . "\n"'

which will give:

  • replace saltsalt by any random string

Please note that you cannot put a plain text password in /etc/passwd or /etc/shadow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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