How do I make it so users have to be in the wheel group to su to root?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Well, if you remove the setuid bit from su, nobody will be able to su to root (after all, programs can't magically jump privilege levels). The correct way to do it (in most cases) is to edit the /etc/pam.d/su file. You can add a line like:
to require users to be in the wheel group to su. In fact, most distributions have this line in place, but commented out.
If you're on a distro like Slackware that doesn't use PAM by default (one of the few things that really annoys me about Slack BTW), just make /bin/su owned by root:wheel with permissions 4750 so that no one not in group wheel can execute it.
Right, you're correct that configuration will only allow users in group gaurav to run su (sorry if I was unclear on that), but because su doesn't have the setuid bit, it won't be able to execute the setuid system call to change the UID to 0. You can try this yourself.
No, the setuid bit only means that the binary should execute with the uid of the owner of the binary, not with the user running the program. For example, /bin/passwd has to run setuid to root since non-root users can't edit /etc/passwd and /etc/shadow. The setuid bit doesn't affect who can run the program, only what prvileges it runs with.