4 Years
Discussion Span
Last Post by Assembly Guy

I don't know that you can find out what the password for root is, unless you have it already and can thus login as root. There would be no point in having a password if you can find out what it is without having the proper credentials.

However, one common issue (with beginners) is that they try to issue a su command (which temporarily switches to root user (super-user) within the current terminal) and it doesn't work because they don't know the root password. Normally, if you have super-user privileges on your account, you can use the sudo command to run a particular command under super-user (e.g., $ sudo yum install ..). You can also use that command to do the su command, i.e., you can do $ sudo su, which will require your user password (not the root password), and will grant you super-user status (root). After that, if you want to change the root password (which is randomly generated upon installation), you can use the passwd command.

You can also recover from having forgotten the root password by booting into single-user mode. See instructions here.

But if your user account is not a "sudoer" (meaning you can do sudo from your user account) or you don't have physical access to the computer, then it means that you do not have the necessary credentials to be a super-user on the system. And at that point, trying to get the root password would be tentamount to hacking the system... and that's a game we don't play here.


which will require your user password (not the root password)

That depends on /etc/sudoers. Sudo can be configured to require the root password rather than the user password. However you are correct in assuming the default is the user's password.

Edited by Assembly Guy

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.