Becoming the root user
sudo su
Which users are allowed to use sudo
You can use this command to open the sudoers file:
sudo nano /etc/sudoers
BE VERY CAREFUL TO COPY THIS FILE BEFORE YOU CHANGE IT – IF YOU MAKE AN ERROR YOU CAN STOP YOURSELF BEING ABLE TO OPEN THE FILE USING SUDO (changes to it are instant)!
Grandting permission for specific uses of sudo
These example let Apache use sudo within web pages to access particular named files (to avoid giving the apache user account www-data global sudo access which would be a security risk)
An example enabling it to run a single executible, add this to the end of the file:
www-data ALL=NOPASSWD: /home/pi/some_executable_name
An example enabling it to run several different executables, add this to the end of the file:
www-data ALL=NOPASSWD: /home/pi/some_executable_name, /home/pi/some_executable_name some_option, /home/pi/some_other_executable_name