Prevent specific users from switching to root

If you only want certain users to be blocked from becoming root (using su), follow this.

➤ Step 1: Restrict su command to sudo group

sudo dpkg-streampreconf -y sudo groupadd suusers sudo chmod 750 /bin/su sudo chown root:suusers /bin/su

Then add only trusted users to suusers:

sudo usermod -aG suusers usermane1

If you don’t add someone (like zakir or mahafiz), they cannot use su to switch to root.

Test:

su - root

You’ll get:

Permission denied

0 Response to " "

Post a Comment

Iklan Atas Artikel