Notes for How to Make `sudo' Work


I put here brief notes for how to make `sudo' work. The meaning of `sudo' is `superuser do.' Chek if you can use this command from your prompt. In the following examples, suppose your user name of the local machine is `gerogero,' the local machin's name `machine,' and your prompt is `$' again. For instance, enter
     gerogero@machine:~$ sudo ls /etc
Then, you are required to enter your password as
     We trust you have received the usual lecture from the local System Administrator. 
     It usually boils down to these three things:
         #1) Respect the privacy of others.
         #2) Think before you type.
         #3) With great power comes great responsibility.
     [sudo] password for gerogero:
After entering your password, if you find the phrase,
     gerogero is not in the sudoers file. This incident will be reported. 
then you have to edit the sudoers file and add your user name in the sudo group in the following: First you should become the superuser.
     gerogero@machine:~$ su
Then, the superuser's prompt appears.
     root@machine:/home/gerogero#
You should change the information of your user account with the command `usermod.'
To add `gerogero' in the sudo group, we type the following:
     root@machine:/home/gerogero# usermod -G sudo gerogero
Check if gerogero is added in the sudo group:
     root@machine:/home/gerogero# cat /etc/group | grep gerogero
     sudo:x:27:gerogero
     gerogero:x:1000:
If you can find `gerogero' like in the above, it's OK.

Note: You can put the gerogero file in the directory `/etc/supdoers.d' provided you find the phrase `#includedir /etc/sudoers.d' in `/etc/sudoers' instead of the way mentioned above.

Move back to gerogero's prompt:
     root@machine:/home/gerogero# exit
After gerogero's prompt appears again, rebooting your machine is the easiest way to make the sudoers file valid. After rebooting it, you can use the sudo command:
     gerogero@machine:~$ sudo ls /etc
Then, you are required to enter your password as
     [sudo] password for gerogero:
You can see the contents of `/etc' this time entering your password, which means that you can use several comands like the superuser using `sudo.'