Difference between revisions of "Linux comand: visudo"

From RHS Wiki
Jump to navigation Jump to search
 
Line 11: Line 11:
 
or with some arguments:
 
or with some arguments:
 
  joe ALL=(ALL) NOPASSWD: /full/path/to/command ARG1 ARG2
 
  joe ALL=(ALL) NOPASSWD: /full/path/to/command ARG1 ARG2
 
== fixroute script ==
 
<source lang="bash">match=$(route -n | awk '{print $1 " " $2}' | grep '0.0.0.0 172.27.0.1')
 
 
if [ ! -z "$match" ]; then
 
    sudo route del -net 0.0.0.0 netmask 0.0.0.0 gw 172.27.0.1 enp0s25 >> /tmp/fixroute.log
 
    echo "\033[1;32m Removed route from routing table \033[0;00m"
 
    sudo route -n
 
else
 
    echo "\033[1;31m Route not found: -net 0.0.0.0 netmask 0.0.0.0 gw 172.27.0.1 enp0s25 \033[0;00m"
 
    sudo route -n
 
fi</source>
 

Latest revision as of 08:02, 7 June 2018

visudo

To give a user sudo permits

sudo visudo

add line:
pi ALL=(ALL) NOPASSWD: ALL
or
root ALL=(ALL:ALL) ALL

To allow some unprivileged user to run some commands with sudo:

joe ALL=(ALL) NOPASSWD: /full/path/to/command

or with some arguments:

joe ALL=(ALL) NOPASSWD: /full/path/to/command ARG1 ARG2