开启sudo

RHEL and Debian

new user

#useradd tdtc
#passwd tdtc

Append group

Modify su file

  • CentOS 6 v6 and below versions

Open wheel

#vi /etc/pam.d/su
auth required /lib/security/$ISA/pam_wheel.so use_uid

Attachment of group members

#gpasswd -a tdtc wheel

Command

  • CentOS 7/8
  • Debian
    Migrate to Debian before Ubuntu 20.04 ends support (April, 2025).

CentOS 7/8

CentOS8 needs to be executed locally, Unable to execute on ssh network side.

#usermod –aG wheel tdtc

Debian

adduser tdtc sudo

test

Query all users with sudo permissions.

[tdtc@tdtc102 ~]$ sudo lid -g wheel

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for tdtc:
 tdtc(uid=1000)
[tdtc@tdtc102 ~]$

参考