How to get a shell with root access in Ubuntu similar to “su” in RedHat or Fedora Linux
In Category Ubuntu
In RedHat or Fedora systems, you will separate passwords and separate user accounts for root and non-root user.
But in Ubuntu, the default user already has root privileges but not allowed to run any command that requires root privileges directly. Instead the user needs to use “sudo” command to invoke any command that requires root privileges. However this is little bit inconvenient if one (especially a RedHat/Fedora user who is used to “su” command) is sick of “sudo” command and wants a full shell access with root privileges.
In Ubuntu, you need to provide self password whenever “sudo” command prompts for password.
There are two alternatives to get a full blown shell with root privileges in Ubuntu.
Method1:
neo:/home/neo> sudo bash Password: root:/home/neo>
Method 2:
neo:/home/neo> sudo -i Password: root:/home/neo>
There is a third method — just set the password for the root user!
neo:/home/neo> sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
neo:/home/neo>
It might also be necessary to set up root’s home directory in /etc/passwd, a trivial task for an experienced admin.
Of course, this method sort of defeats the whole purpose of disabling the root user, but IMHO that’s just stuff and nonsense. The root user has the power to destroy the entire system. The Ubuntu default strategy is to put 5 keystrokes between an inexperienced admin and Armageddon.
sudo rm -rf /usr/bin
(seen it happen)
s.u.d.o.space, 5 keystrokes. There’s some safety. That’s like using toy balloons for airbags. So long as you don’t drive into a tree, they work fine.