5

I have installed 12.04 LTS but surprisingly not able to login as root. I have unlock and set the password for root but while login i can not see 'other' option in GUI login where i can put root id and password.

please help me.

2
  • @JorgeCastro, he's trying access root using the login interface.
    – FRD
    Apr 27, 2012 at 16:46
  • See askubuntu.com/q/16178/6161 about why this is a REALLY bad idea. Apr 27, 2012 at 16:50

8 Answers 8

7

Caveat: Don't do this unless you have a good reason

I store my home directory in lvm and occasionally need to unmount it to perform maintenance. It's much more convenient to login as root in those circumstances, as I can look up documentation online and browse the web while waiting for fsck.

By default, Ubuntu's greeter LightDM no longer supports logging in with an arbitrary username as it did in the past.

Default Config

But this is still Linux, and we can configure this. Edit /etc/lightdm/lightdm.conf with root privileges and add this line:

[SeatDefaults]
greeter-show-manual-login=true

Reboot, and you can now login as any user by username including root.

Altered Config

1
  • I'm so glad you answered. I've been using a uid under 1000 since before Linux was written, and this was just what I needed. To those who declined to answer the question and said instead, "use su", I say, "not helpful". Mar 26, 2019 at 19:43
1

You can also try opening the terminal (ctrl + T) and entering the following:

sudo su

type your password, and you should then have root privileges. Hope this helps! :)

Note: Try sudo nautilus also, so you can explore folders and file in the GUI.

1
  • 1
    i want to login as root in GUI.
    – Tapas
    Apr 27, 2012 at 16:46
1

This is not possible (without a lot of work manually overriding stuff) because it is pretty much always a bad idea.

In this question, there is a good discussion about the many things that can go wrong if you log in as root. Many things won't work at all. Other things won't work as expected. If you do anything wrong, you could destroy all the data on your computer. It makes your computer more vulnerable than windows to malicious attacks.

In all cases I've ever heard of, when a person is asking how to log in as root, they are trying to log in as root to accomplish something that could be better done without logging in as root.

As such, I recommend editing the question to ask how do best accomplish whatever you are actually trying to accomplish. We'd be happy to help you get to your goals :)

4
  • thanks...well while installation i created 3 partition /,/home,/swap...now after installation i can not see /home...i can see home folder under / but cant see /home drive or directory.
    – Tapas
    Apr 27, 2012 at 18:06
  • @Tapas If you have just recently installed, the easiest way to fix this would be to simply install from scratch. However, if you do already have files you want to save, boot from the CD (or DVD or flash drive) you used for the installation. From there, you should be able to fix whatever is broken. (If you need more help fixing the partition, I'd recommend putting in a new question - I don't know enough to help with that) Apr 27, 2012 at 18:39
  • Not everyone who wants to do this is a noob. My /home is located on an lvm partition, and when I unmount it to do maintenance I would login as root so I could use tabbed terminals, and pull up documentation in a browser. May 3, 2012 at 2:14
  • that solved my issue Sep 20, 2017 at 9:03
0

To do that you should try writing these on the terminal window (ctrl+T):

sudo su
passwd

For the first command you will probably have to type in your password. The second will set your root password to whatever you enter.

1
  • not this option.. i want to login as root
    – Tapas
    Apr 27, 2012 at 16:47
0

As far as I know you can't login as root at the GUI login screen and it would be a bad idea anyway. Juan's answer is correct - you can launch a terminal and sudo su to root user (if you are in the sudoers group) and then launch a program which uses a GUI if you wish.

2
  • this option was available till 11.10..is it not available in 12.04?
    – Tapas
    Apr 27, 2012 at 16:50
  • I used 11.10 for a long time and never realized that was possible. I see from this site: [blog.sudobits.com/2011/09/05/… that it was. I really don't want to test that on my current system it seems like a terrible security risk.
    – in8sworld
    May 1, 2012 at 15:54
0

First:

To actually enable root logins, first you have to set a password for the root account, and then unlock the locked root account. If you don't set a password for the root account the passwd command will return

`passwd: Unlocking the password would result in a passwordless account`

So, first execute in a terminal

sudo passwd root

you will prompted for a new Unix password. Write it twice(second for confirmation).

Then execute

sudo passwd -u root

to unlock the account. This should return

passwd: password expiry information changed

Reverting back

If you want to disable root account in Ubuntu you need to lock the root account by using the following command sudo passwd -l root

Second:

Open the terminal:and type

gksudo gedit /etc/ect/lightdm/lightdm.config

(Orignal ) this it what it should already look like:

[SeatDefaults] 
greeter-session=unity-greeter          
user-session=unity                         
greeter-show-manual-login=true 
greeter-show-manual-login=true 

(What you need to replace the orignal with)

[SeatDefaults] 
autologin-user=<YOUR USER> 
autologin-user-timeout=0 
user-session=ubuntu 
greeter-session=unity-greeter

You will auto-log into root

0

Please follow the steps:

before doing any changes please take the backup:

mkdir bakup
cp /etc/gdm3/custom.conf backup/
cp /etc/pam.d/gdm-password backup/

sudo nano /etc/gdm3/custom.conf

And add the following line in the [security] directive and save the file.

[security]

AllowRoot=true

[xdmcp]

Then Save it


Now run sudo nano /etc/pam.d/gdm-password file. And add the hash (#) sign to the start of the following line and save the file:

#auth required pam_succeed_if.so user !=root quiet_success

To apply these changes, we have to restart the system. After the restart, login from the root account again and verify that the root account is enabled.

-1

$sudo -i

enter the password

su

startx

A new desktop screen with GUI root account will emerge. The previous desktop though still remains alive for use after you log off the root account. I feel that this way of accessing the root in GUI is better that creating a permanent GUI account of root.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .