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.

(adsbygoogle = window.adsbygoogle || []).push({});

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...