Restrict useradd in linuxsudoers

Source: Internet
Author: User
Sudo, which restricts useradd in linuxsudoers, is familiar to everyone and allows an account to execute some applications as other identities. The problem we encountered today is that we want tom users to manage system accounts. However, when you grant the useradd permission to the tom account... in linux sudoers, sudo, which restricts useradd, is familiar to everyone. it allows an account to execute some applications as other identities. The problem we encountered today is that we want tom users to manage system accounts. However, if tom executes useradd with-g root or useradd-G root for the tom account, security issues may occur. So you need to limit it. Of course, it is good to limit the passwd command: tom ALL = (ALL)/usr/bin/passwd [A-Za-z] *,! /Usr/bin/passwd root this is because passwd is followed by a very small number of parameters. for the useradd command, there are many parameters. This won't work, for example, tom ALL = (ALL)/usr/bin/passwd [A-Za-z] *,! /Usr/bin/passwd root,/usr/sbin/useradd [a-zA-Z] *,! /Usr/sbin/useradd-G root [a-zA-Z] * if sudo useradd-u 1000-G root user1 is executed, the operation can still be successful. I thought about it. I have to match any combination of-G and other parameters. After some tests, write: tom ALL = (ALL)/usr/bin/passwd [A-Za-z] *,! /Usr/bin/passwd root,/usr/sbin/useradd [a-zA-Z-/] *,! /Usr/sbin/useradd [a-zA-Z-/] *-G root [a-zA-Z-/] *,! /Usr/sbin/useradd [a-zA-Z-/] *-g root [a-zA-Z-/] * this does not include numbers or-g root, can be added according to similar times.

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.