How do I gain root privileges?
Solution 1:
There are 2 ways to do things with elevated permissions.
sudo
lets you run commands in your own user account with root privileges.
su
lets you switch user so that you're actually logged in as root.
But this options is by default disabled on Ubuntu. Instead you can simply start a root shell with sudo -i
.
Read What are the differences between "su", "sudo -s", "sudo -i", "sudo su"? for more information.
Use either method only as and when needed, they can cause your system damage if used without caution.
Solution 2:
This should make you root after you enter your user's password, assuming you were the first account to be created. Be careful when you're root. Only login as root when you really need to, and logout as soon as you're done.
sudo su -
Alternatively you can run specific commands with root privileges by prepending them with sudo
. For example:
sudo cp -p foo bar/