0

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.

Example:

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

OR

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

2 Answers 2

1

To generate the encrypted password you can use the perl function

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

which will give:

6$saltsalt$dbMv1WdXXWhYJXZCacilMdWabQOTCkYM.6OIQb/.md67MGEi2mORqm2dx6vAzJ.frP0Nm7m/c8lMQq5OFRTM0/
  • replace saltsalt by any random string

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

0
0

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.

3
  • 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, 2015 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, 2015 at 17:57
  • @John Depends whether you're the attacker or the defender… Mar 24, 2015 at 23:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .