Get a Root Terminal in Ubuntu
Ubuntu has the root account
disabled and encourages the use of
sudo
to run commands as root. If you are doing some work requiring root
access, it can be tiresome to type sudo
over and over. The normal way to get a
root shell is the su
command, which doesn’t work in Ubuntu.
This command is the equivalent of su
for Ubuntu, it asks for your password and
switches to the root user:
sudo -s
And don’t forget to type exit
to switch back to your normal user when you are
done.
Archived Comments
menek
Why “sudo -s” and not “sudo su”?
bijesh
thank you
Ya its working for me in my Ubuntu12.04
Lokesh
sudo -s is the command which moves to normal user to Admin user
Sudo su is the command which move in to home directory
Kirrus
‘sudo su’ works - the su command has not been removed, it is too valuable for logging on as a user ‘su [username]’.
kirrus
Oops… also, you can hit CTRL+D to exit from the su mode, as well as closing the terminal, and logging out from ssh sessions.
Tom
Kirrus, menek, jackflap
sudo -s does exactly the same thing as sudo su. Either one is fine.
Maxo
There is also a root terminal that is in the Applications menu. You have to right-click to edit the menu’s and add a check to the root terminal listing.
Jaeson
Maxo, I think this is by FAR the easiest solution. Works like a charm
Lametard
I do ‘sudo passwd’ and make a root password, then I can just login as root do a simple ‘su’ to get a root terminal.
habtish
and how is sudo -i different?
rscott
I was taught to use ‘sudo bash’ in Ubuntu, does that do the same thing?
MystaMax
According to the Ubuntu Wiki, sudo -i and sudo -s are the same thing as typing sudo -su
https://help.ubuntu.com/community/RootSudo#head-e5dd6585ff1d17e0ded49d7f947b462ac22f37c7
Lametard, I’m not sure why you’d want to enable the root account, when sudo is as easily available to you. Just another possible security whole you have to deal with. Just my two cents, I’m not knockin’ what you’re doing…
kirrus
I tend to enable the root account, just for the backup it gives me, and for when I want to quickly get access to the root shell.
Anonymous
it stinks, my vista computer is down for about 24 hours and i am working on my dad’s computer to get it working for youtube videos. he hasn’t bothered to try and do this so i decided to take the time to try….. geez, this stuff is weird and I can’t do anything without his root password. I probably won’t check this post again but is it possible to create another password or to overwrite the existing one?
Heru-kun
create a new user with sudo addusr and use that one in command line for install purposes =P
lllllllllll
With Debian it doesn’t work with sudo -s …. is there any possibility to type in a command which gives me administrative rights (root) with that Debian Linux… or how to find the root terminal…. i think i heard about that one anytime but i got no idea if it exists….
oldefoxx
Ubunty comes without mention of the roor password. Not a big problem, because su amd sudo both let you become root for a period of time, and you only need to know your own password.
Biggest limitation is that neither root or su can get a GUI session going in Ubuntu, and if you are in a GUI mode, it is with just user rights. Any steps beyond user rights will requiire re-entry of your password, sometimes repeatedly. One method around this is to keep a su terminal window open and try to work up the needed commands when something proves beyond reach while in a GUI.
A typical situation might involve an effort copy or move files from one place to another. If the user lacks the needed rights, then root or su will likely have to do this with a cp or mv command, But then the ownership and rights will shift to root, and the user still cannot work with them in the GUI mode. Then the root or su will need to use either the chown or chmod commands to correct this.
I guess the thinking was that keepiing the root and su out of the GUI mode will somehow act to keep most users away from those two powerful modes, but you still have to have and use them at times.
An easy way to work around this goes like this: You use either root or su while in the terminal to get to use the command chmod -777 to clear the restrictions on every folder and file at that level and below. Then you are free to make use them from the GUI level as well.
Sounds positively unsecure and overbearing, doesn’t it? Like I am going out out my way to blow holes in the elaborate and detailed security levels set up to protect Ubuntu users from any threats, including their own preference to have administrative rights when working even in a GUI state. But let me point out that the illusion of heightened security is strictly falsehood. All Linux-based distros are equaily weakened by at least three key factors.
The first factor is that it is common coded, widespread, well documented, been around for decades, and available to anyone anywhere. That is not a basis for building any degree of security, in or out.
The second factor is even if you worked out a degree of security, such as internal encryption, there is always risk from social engineering efforts and hidden oversight methods..Even when you feel you have real security in place, you may be just deceiving yourself. Real security is more about people then dependence on system concepts.
The third factor is that even if you do achieve some level of added security in one distro, the availablity of tools in other distros, many readily available through LiveCDs,, can easily bypass built in firewalls and roadblocks. As an example, Fedora 13 relies on a special table named /etc/sudoers to define who can become suoer user, and the only tool that can edit that table if running under that OS is one named visudoers, which you must already have root or su rights to even get access to. All I had to do is boot up a Ubuntu LiveCD, get access there as su, which is easily done. then tunnel down to the real /dev/ folder and mount those drives, then find and use the LiveCD’s nano to edit the /etc/sudoers file on the Fedora 13 install and add myself to it and save it. Rebooting into Fedora 13, I naturallly was approved to be a su there.
Even if Fedora 13 had been up and running and watching for trick like that with its own monitoring and logging efforts, I could set up two systems, one with Fedora 13, and learn all the safeguard tricks which I tried to get into it from the other system. If I mastered any new tricks, I might then use them for real with some assurance that my methods might be sound enough to gain me some advantage in the real world. I could always pay for classes that might teach me more, or visit hacker s[tes to find out what others are discovering. At the very lease I might end up with a career in cypher security, or fall in with someone willing to pay vast sums for uncovered secrets.
If you want real security to be in place, you do not start with hardware and software that anyone can get off the shelf or dpwnload off the Internet. What you need is something that cannot be found anywhere else. And to mask that there is anything really secret here, you need a cover that is so real that it explains everything related to your comings and goings and other activities, leaving no suspicions unanswered.
To think that government agencies, corporations..big and small businesses, individuals, spy rings, terrorists cells, universities, special interest groups, each thinks to use either Windows, Macs, or Linux, plus the language of their chose and select software, it rings us to a point where we become identified as much by these traits as by the thoughts and beliefs that set us apart. And these become even more pronounced as sites spring up which serve as our online meeting places.
You must realize then that something like Linux and the whole concept of Open Soures serve as unifiers, something that can bring us as individuals closer together. But what works at the individual level can be quite contrary to what groups and larger organizations have in mind. Efforts there to employ somethinng like Linux is recognition of te cost advantages of Open Source amd the quality of the software offered, but then imposition of some easily beaten securty steps is merely to sell the idea that Linux is up to high level protecdtion as well, and I don’t see that as being the case. I suppose you could say that Linux as a whole is too generic in nature to be a proper fit inside a high security environment
tamashebi
I run in Fedora, thanks!
Andy
Go to System > Main Menu.
Select System Tools in the right sidebar.
Check on Root Terminal.
When the System Tools text and the Root Terminal text is un-ital-iced, click Close.
Go to Applications > Root Terminal
Andy
Oops. I mean Applications > System Tools > Terminal
Kashi Yomata
Too much limitations!!!!!
simply changing the distro….
bye bye ubuntu.
brikesh
Thanxxxxxxx
Anonymous
typing exit or Ctrl+D works to close root in terminal
sneha
i m working with ubuntu server 10.0.4 and neither of the above commands are working nor it asked for the passwrd at the tym of installation …. rather than that i cant even access a shutdown command without being a root ..help me with this issue please
avinish
@oldefoxx,
quite convincing what u said!!!
Tebbers
Thanks, helped a newbie a lot!
jackflap
Also ‘sudo su -’ will do the trick.
Don’t know what the difference is though, maybe different environment set-ups?