Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i want to create a sudo user, sudo user should not start or stop
the service.
as like a normal user i created a user called root2
and i edited the user with visudo command and added the below line
to the user root2 and got the full privilages.
root2 ALL=(ALL) ALL
i commented the below line
##Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig
eventhough the sudo user root2 can start and stop the service
which i dont want to give that privilage.
right, well "ALL" means.... "ALL" You're not references the SERVICES value at all, otherwise the line would say "SERVICES" not "ALL". Read the manpage for sudoers to clear things up.
root2?? That's a really dubious choice of name, really really confusing. Remember that there should be no such thing as a "sudo user", you are meant to use NORMAL user accounts, to allow regular users to do some additional admin tasks. It sounds like you're just generally not that comfortable with the sudo framework.
Remember, if you want to stop a sudo user from doing something, you must disable all ability for them to start a shell. For example, if you give a sudo user the ability to run vi as root then they can do whatever they want because vi can spawn a shell.
I don't have a lot of experience with this, but from what I've heard auditing this can be a nightmare. Since you're using Red Hat, you might look at using the mandatory access controls of SELINUX to limit what superusers can do.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.