Ask Your Question

i don't know how to login in root when i don't know the password

asked 2013-10-11 09:12:36 -0500

xiemei gravatar image

i don't know how to install the gcc,after i search some information about it ,i need to login in root.but i don't know the i want to login in single model,but i don't know how to do it.what should i do ?thank you for your help.

edit retag flag offensive close merge delete

6 Answers

Sort by ยป oldest newest most voted

answered 2013-10-11 10:06:48 -0500

updated 2013-10-16 08:57:06 -0500

On a Fedora installation is given the oportunity to the user to set a root password, if you haven't set it at installation time, you can set it now.

Before using sudo make sure your regular user belongs to group sudoers by looking at file /etc/suoders.

Open a console, and type:

sudo su -

Enter your regular user password


Enter the desired password

If your regular user belongs to the sudoers group, he can perform root tasks using sudo, like so:

sudo yum install gcc
edit flag offensive delete link more

answered 2013-10-11 10:09:33 -0500

cobra gravatar image

If this is your machine you can reset the physical password using single user mode, but the modern Fedora installs will still ask for the root password for maintenance before they let you log-in.

The trick is to reboot the machine and at the grub2 prompt select the option that lets you edit the kernel parameters before booting. Add a '1' or 'single' to the end of the kernel line and boot up as normal.

Once you get to the command prompt use the 'passwd' command to set a new password.

If this will not let you in then you might be able to use a rescue disk - any Fedora install should work, as will installers from similar distributions like CentOS/RedHat, etc. Select the 'Repair' or 'Rescue' mode from the disks grub screen.

In repair mode it should find your existing Linux system, but you might have to use the 'chroot' command to make your system 'live' before you run the passwd command.

Once you have the root password, you can install using yum. You might struggle to use sudo until it's configured - and it doesn't come pre-configured out of the box on Fedora. To configure it, you'll need the root password...

edit flag offensive delete link more

answered 2013-10-11 14:00:22 -0500

sideburns gravatar image

And of course, if you have the root password, sudo becomes redundant.

edit flag offensive delete link more

answered 2013-10-12 01:25:37 -0500

hawkfeather gravatar image

updated 2013-10-12 01:39:37 -0500

To make sure that your regular user can perform tasks as root, you'll need to edit your /etc/sudoers fille. After creating a root password, log in as root.

edit flag offensive delete link more

answered 2013-10-16 08:55:29 -0500

You are right @hawkfeather , but if the user doesn't know the root password or if the user isn't in sudoers, he won't be able to edit the file /etc/sudoers right?

edit flag offensive delete link more

answered 2013-10-11 09:55:23 -0500

Guus gravatar image

updated 2013-10-11 09:56:33 -0500

Hello xiemei,

You are not saying which distribution you have, so I will assume it is Fedora, because you are on a Fedora site xD. You have 2 queries in there. I will answer them 1 by 1.

  1. How to install a package like "gcc". Using yum you can install gcc from the commandline as follows:

yum install gcc

However, gcc has lots of different packages so you may want to select the right package, like this:

yum search gcc

An easier route is to do yumex (from the commandline (CLI) or from the menu).

If you haven't got yumex installed, look at the package called Software that is listed under the menu probably under System or System tools. If you are using Ubuntu, then just type system when looking for a program.

[It is really much easier to answer your question if you give more info from the start :) ]

  1. How to log on to root without knowing its password. Especially Ubuntu does not assign any password to root, to protect you from doing dangerous stuff without knowing exactly what you are doing. However, from Fedora you can do the same (I do).

So, how to install stuff?

You use sudo, like this:

sudo yum install <packagename> (without the brackets)

or, if you want to do a lot using root, do sudo -s and you will be logged on as root. No password needed.

However, be careful what you do as root: it is all powerful and you can easily destroy a working system.

Hope this helps.

edit flag offensive delete link more

Question Tools


Asked: 2013-10-11 09:12:36 -0500

Seen: 1,450 times

Last updated: Oct 16 '13