sudo make me a sandwich

Image: xkcd – CC BY-NC 2.5

Let’s say you have a new user needing sudo access to a Linux server. How do you grant him/her this great privilege? First, explain to the new user that sudo rights allow to do pretty much anything on a Linux machine – including screwing everything up! – and that with greater power also comes greater responsibilities. Then, follow this procedure:

  1. Create a new user (e.g. newusername) and add it to group wheel (members of this group have sudo rights):
    sudo useradd -G wheel newusername
    
  2. Set up the password for the new user. First, login as root:
    sudo -i
    
    Then set the password for the new user (e.g. newusername):
    passwd newusername
    
    Finally exit from root with:
    exit
    
  3. Test the newly created user and password by logging in as user newusername:
    su - newusername
    
  4. Test that the newly created user is in group wheel:
    groups newusername