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

 

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *