Configuration and usage of sudo under Linux

The configuration and use of   sudo


1. Configuration instructions
sudo uses the configuration file /etc/sudoers. This file has the following two modifications, which will take effect immediately after modification:
  * Use the root account to run the visudo command and use the vi syntax to edit
  * Use Echo adds configuration at the end of the file, such as:
    '''echo "%monitor ALL=(ALL) NOPASSWD:/bin/netstat -nap" >> /etc/sudoers'''


2. Instructions for use
  * List available sudo commands 
    Use a common account (such as monitor) to log in, and run:'''sudo -l'''
  * To run the available
    commands, add sudo before the command , without using the full path of the command program, such as: ``'sudo netstat -nap'' '

3. Troubleshooting

  问题:sorry, you must have a tty to run sudo
  answer:
     Run visudo and comment out the line " Defaults requiretty"

Guess you like

Origin blog.csdn.net/huzhenwei/article/details/7329916