* 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/shadowbkupChange the current root password the desired one.
[root@localhost ~]# passwd root
Changing password for user root.Now switch to a local user to test whether ‘your’ root password is working or not.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# su – localuser ( localuser is an additional user )Yes, you are now logged in as root with ‘your’ password.
[localuser@localhost ~]$ su – root
Password:
[root@localhost ~]#
Restore the previous root password, which is still unknown
[root@localhost ~]# mv /etc/shadowbkup /etc/shadowThis trick is meant for students and kindly do not misuse .
mv: overwrite `/etc/shadow’? y
[root@localhost ~]#
No comments:
Post a Comment