I'm not sure that you have got what you are actually doing; apologies if the following is obvious to you and I'm reading too much or not enough into your question.
sudo passwd
sets the password for the user root
. Once you have done this, you can log into your machine with the username root
and the password you have set (in a terminal anyway, it is probably not allowed at a graphical login). You can also become
root in a terminal on your desktop by using the command su -
and entering the password for root.
What will not change is your user password, ie the one you use to log in with and the one you use when you use sudo
.
The difference between "becoming root" and using sudo
is that if you are going to perform a series of commands that use root priviledges, you can become root and then run the commands at the prompt (the prompt will normally change from a $
to a #
and may also change colour to show that you are now the root user) whereas if you stay as yourself and use sudo
, each command you enter needs to be preceeded by sudo
.