Categories: How ToLinux

Change Linux Root Password Temporarily

How to change Linux root password temporarily

If you are logged in as root and you don’t know the root password then you can follow the steps. You can easy to change your root password. 

 

Step 1. Back-up your current shadow file.

[root@hostripples ~]# cp /etc/shadow /etc/shadowbkup

Step 2. Change the current root password

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

Step 3. Switch to a local user to test whether ‘your’ root password is working or not.

[root@hostripples ~]# su – localuser 
[localuser@hostripples ~]$ su – root
Password:
[root@hostripples ~]#

Yes, you are now logged in as root with ‘your’ password.

Step 4. Restore the previous root password

[root@hostripples ~]# mv /etc/shadowbkup /etc/shadow
mv: overwrite `/etc/shadow’? y
[root@hostripples ~]#

.

.

.

.

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


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

Crafting a Professional Email: Step-by-Step Guide

Due to growing digitalization, Email Communication has become the backbone of professional interactions. Yet, surprisingly, many professionals struggle to craft…

1 day ago

Demystifying SSL: What Every Website Owner Should Know

As the digital landscape continues to evolve, securing your website has never been more crucial. SSL, or Secure Sockets Layer,…

1 week ago

Cyberduck and FileZilla: A Comprehensive Comparison

As a web designer and web developer your experience must have reached to new height, right? Further, you need to…

1 month ago

The Science Behind Social Media Posting Times

In today's digital landscape, timing is everything. Whether you're a social media manager, business owner, or content creator, the success…

1 month ago

Mastering Google Search Console: Tips for New Users

Are you a website owner? Maintaining the website is the prime concern for any website owner. Yes, it’s equally important…

1 month ago