On Tue, 5 Feb 2008, Clay Fandre wrote:
> s/doesn't have a password/doesn't have a password that you know/
I can believe that because (A) it makes sense [as Florin suggested -- a
random string would be optimal] and (B) several people have said it.
One respondent suggested that this command will allow the user to change
the root password:
$ sudo passwd root
But usually the first step in running the passwd command is to enter the
existing password, which you don't know (doesn't it work that way for root
passwords). This may not be an important issue, but it is still possible
to change the root password by editing the /etc/shadow file -- you just
have to know the encrypted form of your password. This can be obtained as
follows:
perl -le 'print crypt("password", "salt");'
...where 'password' is the unencrypted password and 'salt' is the salt
string (only the first two characters are used) for the crypt command. The
first two characters of the output are the salt. If you have root
permissions on a UNIX/Linux machine, you can check that this works by
reading /etc/shadow, entering your password and the first two characters
of your encrypted password as your salt. This is your salt:
sudo egrep '^username:' /etc/shadow | gawk -F':' '{print $2}' | cut -c -2
...where 'username' is your user name. I tried it and it worked
perfectly.
(It is not a great idea to run the perl command from the command line
because it will leave your password in your command history, so it would
be safer to write the perl command into a one-line script, execute it, and
delete it.)
Mike