Introduction – You need to use the passwd command. It is used to update the user’s authentication token(s) i.e. password. Let us see how to change the root user password on RHEL.
How to change root password on RHEL
The procedure for changing the password of root is as follows:
- First, log in to the RHEL server using ssh or console
- Open a shell prompt and type the passwd command to change root password in RHEL
- The actual command to change the password for root is sudo passwd root
RHEL change root password command
I am going to log in to my RHEL 7.x/6.x/8.x server using the ssh:
ssh vivek@rhel8-box
Once logged in enter the command passwd as follows:
sudo passwd root
First you need to type the password for vivek user. After that the passwd command asks for the new password, which you will have to enter two times:
Changing root account passwords on an RHEL based system
ssh user@your-rhel-server-name-ip
Become a root user via the su command or sudo command:
sudo -i
OR
su
Finally change your root user password:
passwd
Conclusion
This page explained the process for changing the password of root user using the passwd command.
This entry is 6 of 13 in the root user Tutorial series. Keep reading the rest of the series:
- Linux Login as Superuser ( root user )
- How can I log in as root?
- How do I become superuser on Ubuntu Linux using su/sudo?
- Ubuntu Linux root Password (Default Password)
- How to create a new sudo user on Ubuntu Linux server
- How to change root password on RHEL ( Red Hat Enterprise Linux)
- How to change root password on CentOS Linux
- How to change root password on Alpine Linux
- How to change root password on SUSE / OpenSUSE Linux
- Change the Password in UNIX
- How to change root password on Debian Linux
- How to change root password on Fedora Linux
- How to change root password on macOS Unix
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 3 comments so far... add one ↓
🐧 3 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
If you don’t know root password but want to change root password, try:
We have 5 EC2 boxes at AWS running RHEL 7. We change root password simply by running:
ssh ec2-user@IP-address
sudo passwd root
I did used your command but for loop ;)
262269822603ff6e643bad_000000
done