I am looking to learn
sudo commands for the GNOME terminal.
I am an avid user of Ubuntu however I'd like very much to learn as many commands and shortcuts as possible. I am running Ubuntu 12.04 32 bit on a Compaq Presario cq60.
Probably your concept about
Basically it is a tool used to give root access for normal users.
sudo (superuser do) is a great tool for restricting access to the root account (or other accounts). In normal use, it is setup so that people in the wheel group can run commands as root if they give it their password.
The beauty of sudo is that you can grant root access to certain users without giving them the root password. On top of that, you can specify only to grant them access to certain commands on certain hosts. Best of all, sudo logs every command that is run through it, so you can easily track down any issues that may arise.
Using sudo is ridiculously easy. If you would like to run a command as root, simply type sudo program arguments. For instance:
If you would like to run commands as a user other than root, use
In rare instances, you may need to start an entire shell as another user. This is not recommended because it will not log the commands you execute under this shell, though it sometimes makes things more convenient when you do not have access to a directory you would like to work in. This will start a root shell:
For more tips, I recommend looking at the sudo manual.
Adding yourself to the wheel group
If you type the groups command, you will see a list of groups that you are an active member of.
If it does not say wheel, you will want to add yourself to the wheel group. You can use the graphical management tools that come with your system, or simply use your favorite text editor as the root user, and edit /etc/group. Add yourself to the line that says wheel:
You will need to logout and log back in for the membership changes to take affect. Before hand, you may want to do the next step, however.
Editing the sudo configuration
Open up a terminal, and make sure the EDITOR variable is set to your preferred editor, otherwise you will be editing the sudoers file using vi.
Now you can launch visudo as root:
Enabling the wheel group in sudo
Put # signs at the beginning of these lines:(if not found)
You will then see two lines that mention the wheel group. If you have no sensitive data on your machine, and absolutely trust that no one but you would ever use it or get into it, you can uncomment the NOPASSWD one, otherwise, I do highly recommend the first option. This shows our recommended configuration:
# Uncomment to allow people in group wheel to run all commands
# Same thing without a password
You can now save this file and quit. You should now be allowed to use the sudo command. Changing the password timeout
By default, sudo will ask you for your password after 5 minutes of not using it. You can change this timeout to 20 minutes by adding the following option to your sudoers file with visudo.
If you really want, you can also specify this timeout on a per-user basis.
You can do much more.