Friday, October 19, 2007

How do I get root access in Ubuntu?

I first encountered Ubuntu while going to school for a linux certification. I was fairly accustomed to how things were done with rpm packages and how things worked in opensuse. This particular lab I was studying told me I should be using Ubuntu. At the time, the distribution supplied to install and use was Hoary Hedgehog. I quickly realized I hadn't supplied a root password during install, and the lab manual mentioned nothing about it. So, of course I googled it to find out why. I found out Ubuntu implements sudo to give users access to root commands. Interesting. I thought I could deal with that. But, after continuously entering sudo in front of any command that needed root access, it got very old. I thought there must be a way to enable the root account. It turns out, it's actually very simple to do just that.

All you need to do is: sudo passwd root
Then it will ask you for your password, then you have to enter root's new password twice and you're all set. Now you can login to the root account just like you would on any other distro.

Some may argue that sudo is a security measure, because it's in a way disabling root's account. This is true to a degree, but you could also argue that now there's only one password to circumvent instead of two. And user passwords would typically be much simpler than a root password, for convenience. Some may think enabling root's account opens another hole, by allowing the user to login to the graphical environment as a root user, since that's what they may be used to doing in other less secure OS's (microsoft, anyone?). This isn't the case with Ubuntu though, as gnome by default does not let you log on as root.

A definite advantage to having sudo by default is that new users can't login to the root account and obliterate the system with a command a buddy jokingly tells them to execute (rm -r / is a fun example). But any experienced user would have no issues using root's account, as that's what they're accustomed to with other distros anyway. Personally, every system I install Ubuntu on that I'll be using gets a root password assigned. I couldn't have it any other way.

10 comments:

Anonymous said...

1) sudo -s
2) The only user able to sudo is the user created during the install.
3) sudo gives you far more control over root access than having a root account does. For example, you can specify that a particular user can be root for a specific command, but nothing else.
4) Try to crack the password of my root account. You can't because you don't know the name of the user with that permission level without having an account on the system.

Unknown said...

Or, you could just type 'sudo su' to give you root on that terminal.

Happy Linux Guy said...

You should set your box up so you can't login remotely as root. So, no one can login to my system as root either. What's the big deal?

Gen said...

u can login as root using graphical environment also .for more details check this out.http://nthillaiarasu-linux.blogspot.com/2007/10/how-to-enable-root-login-in-ununtu.html

Suresh Kumar A said...

by using 'sudo -s'

In Terminal window # : type the above command, it will ask for Root Password, once it done. you will become root user

bnight said...

sudo /bin/bash :)

Anonymous said...

Sudo make me a/sandwich :)

Anonymous said...

Very good, thanks alot. I had the same problem when I installed ubuntu it never created any root account and didn't ask for any root password other than a user password. When my manager needed access to root I just googled it and got this article and in just 2 seconds we were all set..saved my life!!!

Vladimir Vooss said...

I built an Ubuntu 10.10 for a friend, with my name/pw and with this I built the system and added the applications my friend wanted. Then I created a second user and gave it limited access, i.e., cannot install software. It's time for updates, and I cannot log-out of her user and into mine, and of course, I can't create a new user either. This Meerkat forgot about me as a user. Do I have to get in as super-user, et al? I'm not used to using Terminal, even on my macs, though on the macs it's easy to get root access, do your business and disengage root access. If I can do this in Ubuntu, I don't know how...
Any help will be appreciated,

Vladimir

Happy Linux Guy said...

Vladmir
Ubuntu uses sudo to gain root privileges. You just use sudo in front of the regular command and it will ask you for YOUR password.