A little over a year and a half ago, a fellow engineer wrote an article for Enabling the Root Password in Ubuntu 11.10 (instead of using sudo). The article was geared towards providing a convenient way to run root commands in a shell without the need to constantly type “sudo” at the beginning of every command.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
Today, I would like to present an alternate method of accomplishing the same task.
At the command prompt type
You will be prompted for your sudo password. After entering your sudo password and hitting Enter, you will be dropped into a root shell. The prompt will be similar to this:
Any commands you type moving forward will be done using root privileges (so be careful!). When you are finished, you can simply press CTRL-D or type “exit” and hit Enter. This will drop you back into your regular user shell.
dave@ubuntu-pc:~$ sudo su
[sudo] password for dave:
Both methods of running a root shell (this and the previous method) have their advantages and disadvantages. I leave it to the reader to decide works best for them.