Oct
18

How to change Linux root password temporarily.

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
Password:
[root@localhost ~]#

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
[root@localhost ~]#

This trick is meant for students and kindly do not misuse .

Cheers, Faheem

1 Comment to “How to change Linux root password temporarily.”

Post comment

Follow us on Twitter! Follow us on Twitter!
http://twitter.com/efheem
The next version of Ubuntu is coming soon

Recent Posts

Recent Comments

Firefox Download Button
Google Analytics Alternative Add to Technorati Favorites Technology Blogs - BlogCatalog Blog Directory Free Hit Counter Technology Google Analytics Alternative Blog Buzzer