Advertisements
Apr 16, 2008:

At times where Linux provides a secure and healthy environment for users, it makes other things even more complicated and intricate. Despite being such a user-friendly operating system, it is not that easy to login to Ubuntu as a root user.

Root user has all the administrator privileges so whenever you need to edit system files or configuration from within Gnome, you will feel the need to login to Ubuntu as a root user. But the question is here is “How to login to Ubuntu as a root user?”

Just follow the steps below:

  1. Open the terminal and type: sudo passwd root
  2. When you see the prompt that says “Enter new UNIX password”, enter the password you want for the root user and confirm it.
  3. Type: sudo gedit /etc/X11/gdm/gdm.conf
  4. Locate the line that says “AllowRoot=false”. Change it to “AllowRoot=true”.
  5. Save the file
  6. Exit gedit, logout and then reboot.

I used the same method when I wanted to login as root user to edit configuration files of my graphics card and everything worked great. However the only issue in this case is that by logging to Ubuntu as root you are making your operating system more vulnerable.

For Ubuntu users it is recommended to use the account which they created on time of install and use the “sudo” command while in terminal to execute commands as root user.

Comments

comments

{ 46 comments… read them below or add one }

Braincrapped April 18, 2008 at 4:50 am

Bad bad bad idea, really.

Never run X with root’s power, there isn’t a reason to do that. If you need to configure something as root-root use sudo properly: ‘sudo -i’

Reply

Mike April 18, 2008 at 8:29 am

I aggree that you should not login to X as root. But Ubuntu style to use sudo is very bad bad bad idea too. If you always login using user who has sudo rights it’s even more dangerous than to login as a root.

Reply

Michael April 20, 2008 at 6:51 pm

You say to edit the gdm.conf file to allow root log in. Well you can edit the “Log In Window” settings under the System > Administration menu you to do this easier. Under the “Security” tab enable “Allow local system administrator log in”.

Reply

boss April 30, 2008 at 9:02 am

I agree with Michael’s idea
It worked.

Reply

Matthew May 30, 2008 at 1:51 am

Actually thanx a lot Michael…my linux system stuck and I couldn’t install nothing…now its cool :D

Reply

jason July 23, 2008 at 1:50 am

I tried this but sudo gedit /etc/X11/gdm/gdm.conf just opens a blank page with no text ???

Reply

r jesse August 4, 2008 at 11:11 am

hi Jason
i tried sudo gedit /etc/X11/gdm/gdm.conf and it didnt work for me either! BUT: there is a better way to just do that! guess what: go to prompt and type:

$locate gdm.conf

where you will get something like:

/etc/gdm/gdm.conf
/etc/gdm/gdm.conf-custom
/etc/gdm/gdm.conf~
…etc

to me the above was my output.

this gives you a whole lots of locations where files with name *like* gdm.conf can be found. THIS IS THE FILE WE NEED TO EDIT.

you can tell from the listing that the first option is the one we r after (or it depends on your output but look for EXACTLY “gdm.conf” file), so you can go for you gedit command now: remove the /X11/ and type it like:

sudo gedit /etc/gdm/gdm.conf

..there we r…

r jesse
Dar.

Reply

Sus September 28, 2008 at 11:01 am

Michael
April 20, 2008 at 6:51 pm

You say to edit the gdm.conf file to allow root log in. Well you can edit the “Log In Window” settings under the System > Administration menu you to do this easier. Under the “Security” tab enable “Allow local system administrator log in”.

Reply

whysoserious1 December 11, 2009 at 5:42 am

there is no security tab in administration menu please help me i want to copy one file in “bin” folder but error is occur when coping u r not owner how i can copy that file in bin folder

Reply

StOlEnDeStInY June 28, 2009 at 10:12 am

For all the tweaks I ever had to make, I never needed to login as root.. If I do have to work directly with files and not use terminal, just write

gksudo nautilus

Reply

Bailey June 28, 2009 at 8:45 pm

Everything I try and edit shows this:
Could not find the file /etc/X11/gdm/gdm.conf.
Please check that you typed the location correctly and try again

Or it says I dont have permission.

Reply

ahmad July 12, 2009 at 3:55 pm

hi
this is very bad command
this command is Bad
/etc/X11/gdm/gdm.conf

this is well :
/etc/gdm/gdm.conf

you can edit with graphical mode
Thanks
Ahmad Choopani , iran
AchVK

Reply

BlueStreak July 16, 2009 at 7:57 am

Correction in Point 3:
it's
sudo gedit /etc/gdm/gdm.conf

Reply

BlueStreak July 16, 2009 at 12:57 pm

Correction in Point 3:
it's
sudo gedit /etc/gdm/gdm.conf

Reply

MRKRaju July 19, 2009 at 8:57 am

Hi, Braincrapped

Thank You
i was trying to install VMWare so i need root access

sudo -i worked

MRKRaju

Reply

Itchyfinger August 9, 2009 at 11:59 pm

BAAAAD, BAAAAAAAAAAAAD idea, sheeple!

I wish people would get the facts straight before they go bleeting one way or the other on how something impacts Ubuntu system security, because it's important for all users, new and old, to know the straight dope. Not only do they need it explained in non-superstitious terms what they can and can't do while logged in as user or root, but they need better justification for the restrictions in play. It takes this sort of review process to perfect a system, and the perfect system is NOT the most secure one – fact is that the most secure system is also the most useless.

While I know only a little myself, being a fairly new user, I WENT AND TRIED THE FIX FIRST BEFORE FORMING MY OPINION! The result is that I no longer get some asinine hassle when I want to browse partitions which are BY DEFAULT less security-sensitive than my system partition, and since you don't need root priveleges to write to your system partitions in Ubuntu (not so with other distros), THEN I WANT TO KNOW WHAT WERE YOU UBUNTU ENGINEERS THINKING IN MAKING AN ISSUE OF BROWSING SECONDARY PARTITIONS?

Anyway, despite being able to browse your own files while logged in as root, you still can't change your system files without the sudo command – I tried that, and it won't let me. Very strange, but that's how it works.

Reply

Itchyfinger August 10, 2009 at 12:09 am

In summary (see above), total write-access does not exist any more (or any less) between a logged-in user and logged-in root user without the use or the sudo command, and then the only thing which non-root-user-status can make particularly difficult is access to partitions not containing his system (unless of course the system is on a separate partition from his home directory).

Reply

Itchyfinger August 10, 2009 at 4:59 am

I wish people would get the facts straight before they go bleeting one way or the other on how something impacts Ubuntu system security, because it's important for all users, new and old, to know the straight dope. Not only do they need it explained in non-superstitious terms what they can and can't do while logged in as user or root, but they need better justification for the restrictions in play. It takes this sort of review process to perfect a system, and the perfect system is NOT the most secure one – fact is that the most secure system is also the most useless.

While I know only a little myself, being a fairly new user, I went and tried tried the first fix before forming my opinion! The result is that I no longer get some asinine hassle when I want to browse partitions which are BY DEFAULT less security-sensitive than my system partition, and since you don't need root priveleges to write to your system partitions in Ubuntu (not so with other distros), Then I want to know what were you Ubuntu Engineers thinking in making an issue of browsing secondary partitions?

Anyway, despite being able to browse your own files while logged in as root, you still can't change your system files without the sudo command – I tried that, and it won't let me. Very strange, but that's how it works.

Reply

Itchyfinger August 10, 2009 at 5:09 am

In summary (see above), total write-access does not exist any more (or any less) between a logged-in user and logged-in root user without the use or the sudo command, and then the only thing which non-root-user-status can make particularly difficult is access to partitions not containing his system (unless of course the system is on a separate partition from his home directory).

Reply

Lindi Maringlen September 4, 2009 at 3:52 pm

this is cool man

Reply

ihateubuntu September 7, 2009 at 9:59 am

sudo: gedit: command not found

Reply

tmath September 12, 2009 at 12:13 pm

Take out the colons, ihateubuntu. Just type in sudo gedit, no extra punctuation.

Reply

Donald September 14, 2009 at 3:04 pm

it says command not found….now what

Reply

Nick September 19, 2009 at 6:58 pm

thank you!

Reply

binay October 1, 2009 at 11:17 am

i just got ubuntu as my os i wanna remuve it plz help me out

Reply

sathiskumar November 23, 2009 at 9:30 am

iam trying this cmd.bt not open the root user.its saying gtk-warring cannot open display.how can i open root account????????

Reply

Debian-root January 4, 2010 at 3:43 pm

The power of root is almighty and easily can render a system useless. That is one way of learning. However there are instances where root login is needed, not only to do admin tasks, but to create files/folder with the owner root. A mate is frustrated as he can not make apps work on the iPhone using Ubuntu, but I can using Debian. There is nothing wrong with his files, but iPhone only except files with root ownership. If you can not login as root you do not get root ownership of files, at least not very easy.

Reply

Psychoscout January 9, 2012 at 12:56 am

This makes no sense, you can just use the command
$gksudo nautilus

This opens an explorer with root permissions, no need to login as root which is dangerous for inexperienced users.

~Psy

Reply

JohnSmith January 4, 2010 at 11:14 pm

Why did they even make it this difficult?
Say what you want about windows but at least they dont treat you like a child.
It's my computer. Let me do what I want without this sudo bs.
That is all.

Reply

quad January 6, 2010 at 9:15 pm

desktop:~$ sudo gedit /etc/X11/gdm/gdm.conf

(gedit:2958): Gtk-WARNING **: Unable to locate theme engine in module_path: “ubuntulooks”,

Reply

quad January 7, 2010 at 2:15 am

desktop:~$ sudo gedit /etc/X11/gdm/gdm.conf

(gedit:2958): Gtk-WARNING **: Unable to locate theme engine in module_path: “ubuntulooks”,

Reply

glennp1954 April 18, 2010 at 3:18 am

I find it rather ridiculous all the exclamations of “you shouldn't do this” or “you'll render it unusable if you do that”. “Don't EVER log on as ROOT” shiver, shiver, shiver. Enough already. It is extremely and painfully obvious that there are functions you cannot do without being logged on as root. And if I end up destroying MY O/S on MY machine that is certainly MY problem. So I'll have to go back, reload and start all over again. That is my headache. I'll take full and complete responsibility for whatever actions you might consider as ridiculously stupid on my part. I surely hope that helps. Why can't we get simple questions answered by the nice folks on this forum without being browbeaten about it?

I have been trying to install and configure various software services on my new Ubuntu install for a week now. As best I can tell it can't be done easily unless I am logged on as root. I have tried the suggestions as to how to turn on root login and I do not see the same options as listed. I have installed Ubuntu 9.10. When I go to System->Administration->Login Screen all options are locked. I cannot find a gdm.conf file that contains a root login option.

How can I get logged in using root so I can finish installing and setting up my software? Please, please, please if your response is to browbeat me, don't respond. If you have a sane and knowledgeable response I need your help.

This all started when I couldn't get osCommerce to work properly on my windows xp machine and got browbeaten because I was “too stupid to use Linux”. Now it has so far been a nightmare trying to get Linux installed and everything implemented so I can start testing again.

Sorry for the soapbox. This has been a frustrating experience.

Reply

RemoteONE May 28, 2010 at 9:36 am

I undertand exactly. I can't update codecs and plugins for Movie,
the ubuntu deault movie player without root permissions. This seems to be a Linux MO. I think I will need to login as root as standard operating procedure before installing apps or upgrades. Then fall back to user login for normal usage?
But if your using osCommerce, your setting yourself up for hard work and years of struggle. I went to csCart and have not looked back.

Reply

remoteONE May 30, 2010 at 7:18 am

Cant locate the gdm.conf file on Ubuntu 9.10
$locate gdm.conf returns “gdm.conf: command not found”

Where is this file in server 9.10?

Menconiusa July 23, 2010 at 12:00 am

I had same issue as you. Turns out the first part where I changed the password was enough. Have you tried choosing other user at login prompt and trying your root / newly made pw combo?

Reply

glennp1954 July 23, 2010 at 12:14 am

It was easy!! I just quit using Ubuntu. No more problems with Ubuntu. No need to ask questions and get chastized for “breaking the rules”. It appears you can't do anything in the Linux world unless you can magically absorb knowledge and experience and not have to ask these useless and inane questions.

Mdmann November 17, 2010 at 8:32 am

I agree 100% with your first paragraph. I have been using Linux as my primary operating system since about 1998 (TurboLinux, to RedHat, to Fedora, to Ubuntu), and I have almost always, on every system I’ve created and been the sole user on, logged in and done everyday work under the root account. I’m on the computer several hours a day, and have not hosed a system yet. Not one. I get sick of typing sudo after just a few times. If you just pay attention to what you’re doing, you shouldn’t have a problem.

Reply

Fadi Tamimi May 31, 2010 at 2:57 am

Hello
I would thank you very much for you declaration as I had suffered from being search on my root account, I had successfully changed the root password but when I tried to open the file gdm.conf I could not find the path gdm under X11 ??? please notice that I am using Ubuntu 10.04 Desktop

thanks again
regards

Reply

A.Y. Siu June 10, 2010 at 4:15 am

“It is extremely and painfully obvious that there are functions you cannot do without being logged on as root.”

sudo -i for a persistent root prompt. gksudo nautilus for a root-privileged file browser.

Logging in as root is wholly unnecessary and actually inconvenient.

Reply

Jeof Adriel August 3, 2011 at 12:57 am

Thanks a lot. I think this is better than logging as root. 

Reply

Matthew Cousins June 17, 2010 at 4:51 am

I'm stuck at part 3. /etc/X11/gdm/gdm.conf doesn't exsist…..

Reply

DrAcid August 26, 2010 at 5:09 pm

Guys, in Lucid Lynx You can just go up to the step#2 and afterwards go to the login screen, click “Others” and type “root”, then enter chosen password… voila…
No conf file change needed ;)

Reply

GHead October 6, 2010 at 2:36 pm

Thanks for the tutorial.
I agree with you. The password box when install something is really annoying.

Reply

Taylor November 9, 2010 at 10:06 pm

When I open gdm.conf to edit, I get a blank document.
I’m running Ubuntu Studio Edition 10.10

What is the issue I’m having

I did everything before correctly…

I’d love some help.

Reply

d shyam June 1, 2011 at 6:30 am

(gedit:8171): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel’, but failed: No such file or directory

Reply

Nichel Jangiti April 14, 2012 at 1:43 am

The ubuntu root is not accesable most times that a BUG for certain, that’s the reason to lookinto FreeBSD and Debian for source documentation. No luck still can someone write on ubu they got no code fixes on the man site

Reply

Leave a Comment

{ 2 trackbacks }