How to change root password on RHEL ( Red Hat Enterprise Linux)

I am a new user of Red Hat Enterprise Linux servers. I need to change the password for root user account. How do I change the root password on RHEL ( Red Hat Enterprise Linux) using command line options?

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:

  1. First, log in to the RHEL server using ssh or console
  2. Open a shell prompt and type the passwd command to change root password in RHEL
  3. 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

The next time you log in to an RHEL server/workstation, use the new password. One can use the following procedure too:
ssh user@your-rhel-server-name-ip
Become a root user via the su command or sudo command:
sudo -i
Finally change your root user password:


This page explained the process for changing the password of root user using the passwd command.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Wendy Feb 13, 2018 @ 19:18

    If you don’t know root password but want to change root password, try:

    1. Reboot the server
    2. Enter BIOS password, if any
    3. You need to edit GRUB boot loader’s menu
    4. Look for single user mode or recovery mode option and hit ENTER key
    5. If there is no single user/recovery mode option, choose normal kernel entry. Press e to enter edit mode. Choose the line starting with kernel or linux. Again press e. Add the word single at the end. Press Enter and boot the edited config.
    6. When RHEL booted into a single mode, run the following commands
    mount / -o remount,rw
  • Santosh May 11, 2018 @ 13:20

    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

    • Sam Oct 7, 2018 @ 23:01

      I did used your command but for loop ;)



Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum