Here the official (?) doc for sudoers and sudo. Particularly important in the sudoers file format, with the User_Alias Runas_Alias Host_Alias Cmnd_Alias story. It's very important to read all the options, since it's very versatile and allows you to get well organized if you know them.
A simple example here: how to give all root privileges to user vagrant:
Login as root
visudo
append this:
sudo su - vagrant
cat /etc/sudoers
cat: /etc/sudoers: Permission denied (of course, vagrant user cannot see the /etc/sudoers file which is only read for root)
sudo cat /etc/sudoers
this one works, because it's being executed as the root user !
Hint: you can also use visudo -f /etc/sudoers.d/filename
A simple example here: how to give all root privileges to user vagrant:
Login as root
visudo
append this:
exit visudo with :wq
vagrant ALL=(ALL) ALL
sudo su - vagrant
cat /etc/sudoers
cat: /etc/sudoers: Permission denied (of course, vagrant user cannot see the /etc/sudoers file which is only read for root)
sudo cat /etc/sudoers
this one works, because it's being executed as the root user !
Hint: you can also use visudo -f /etc/sudoers.d/filename