Su and sudo commands

Source: Internet
Author: User

Su-user name does not add minus sign environment variable does not switch
WHOAMI View Current User
 
   
  
  1. su - -c “mkdir /tmp/file” 用户名
With the-C option, you can execute commands without switching users sudo temporarily has some permissions to use sudo to temporarily have root privileges without knowing the root password for the normal account, which is for security purposes and cannot be logged on.
Visudosudo-l See what permissions a normal user has under sudo visudo command to edit the relevant configuration file /etc/sudoers. If you do not have visudo this command, please use
 
   
  
  1. yum install -y sudo 安装
  
 
  1. ## Allow root to run any commands anywhere
  2. root    ALL=(ALL)   ALL
  3. test    192.168 8.1 / 24 = ( root NOPASSWD : / bin / ls , / usr / bin / passwd
  4. test1   ALL=(root) /bin/ls,/usr/bin/passwd
Can restrict IP and commands

From for notes (Wiz)

Su and sudo commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.