How can I get root access after I installed Ubuntu on my PC? The system keeps telling me that I have to be root for execution some of the commands.
2 Answers
The standard approach is to prefix such commands with sudo
. By default the userid you created during the installation will be able to use sudo
. When you use sudo
you will be prompted for the password of the userid you are running the command from (not the root password). You can enable additional users by adding them to the admin
group or adding them to /etc/sudoers
. On Ubuntu this can be done by adding the appropriate configuration lines to a file in the /etc/sudoers.d
directory. These files need to be owned by root, and should no be accessible to others.
The command visudo
can be used to safely edit sudoers
files. By default it will use vi
as the editor but it will use another editor if the EDITOR
environment variable has been set to the desired command and exported.
Add sudo
in front of the commands that are asking to be run a root.
sudo
basically tells Ubuntu to run the command as the root user
You will be asked for your password
An alternative is running the sudo -i
command and this will run all commands entered as root for as long as that terminal session remains open or exit
is typed
EDIT: Be carefully with the sudo
command as you can do seriously damage to Ubuntu, as I have found out many times myself.