This is a simple technique by which you can have your our root password temporarily and change it back to the real one after use. The condition is
* You are logged in as root and you don’t know the root password
Back-up the current shadow file.
[root@localhost ~]# cp /etc/shadow /etc/shadowbkup
Change the current root password the desired one.
[root@localhost ~]# passwd root
Changing password for user root.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Now switch to a local user to test whether ‘your’ root password is working or not.
[root@localhost ~]# su – localuser ( localuser is an additional user )
[localuser@localhost ~]$ su – root
Yes, you are now logged in as root with ‘your’ password.
Restore the previous root password, which is still unknown
[root@localhost ~]# mv /etc/shadowbkup /etc/shadow
mv: overwrite `/etc/shadow’? y
This trick is meant for students and kindly do not misuse .
POST YOUR COMMENTS (Cancel)