473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Locking down /etc/sudoers

Colloid Snake
144 100+
Hello-

I am attempting to lock down a server that has been neglected for a few years, and while I changed most of the permissions to allow the specific group I needed, is seems there is a file that is scripted to revert its permissions to not allow any groups to edit it.

So I would like to set up /etc/sudoers so that this group can do anything they need, as long as it is within a certain directory. I think this involves the

%users /opt/directory = groupname

but I'm having trouble with the syntax of that, and the man page is just confusing me even more. Can anyone help me out with the syntax?
Jan 17 '08 #1
4 6799
prn
254 Expert 100+
Hi Snake,

I don't blame you for finding this confusing. It's not at all clearly written.

Here's an example from on of mine. I put the scripts that I want the relevant people to run in /usr/local/sudo (I have a pretty restricted set of people I want to allow so I don't need any more granularity than this) and so here's the "User privilege specification" section of my /usr/local/etc/sudo file (that's how mine is set up anyway):
Expand|Select|Wrap|Line Numbers
  1. # User privilege specification
  2. root    ALL=(ALL) ALL
  3. operator        ganymede=NOPASSWD:/usr/local/sudo/
  4. helpdesk        ganymede=NOPASSWD:/usr/local/sudo/
  5.  
Here, "ganymede" is the name of the host and I've granted both operator and helpdesk privs to run anything in /usr/local/sudo without entering an additional password.

Personally, I suspect that this is the most comon and basic sort of config you're likely to get. I just want these folks to be able to do some specific tasks without additional hassle. (Training them to do more can be problematic.) I've put /usr/local/sudo on their paths and they don't need to know much of anything except WHEN to do what they need to do.

By making the tasks scripts in a directory they have no other privs to (especially not write priv) all they can do is run what I give them.

YMMV.

HTH,
Paul
Jan 17 '08 #2
Colloid Snake
144 100+
Oh, cool, that's a good idea.

So in the /usr/local/sudo/ are you copying over whatever is in /bin or /sbin ? Or are you symlinking?

I would like the users coming in to be able to sudovi a specific file, so I guess my question is more: how would you pass parameters in that case? I'm thinking it would just be in a shell script, and then put that into /usr/local/sudo/ . How does that sound?

Thanks

~Snake
Jan 17 '08 #3
prn
254 Expert 100+
So in the /usr/local/sudo/ are you copying over whatever is in /bin or /sbin ? Or are you symlinking?
Actually, I do neither. I just have scripts in /usr/local/sudo.The scripts can call normal system command from /bin or /sbin, no copying or linking required. In fact, you would not want a copy or symlink of, e.g., rm to sit in /usr/local/sudo because then the users could rm anything anywhere.

I would like the users coming in to be able to sudovi a specific file, so I guess my question is more: how would you pass parameters in that case? I'm thinking it would just be in a shell script, and then put that into /usr/local/sudo/ . How does that sound?
By sudovi, I take it that you mean you want them to be able to edit a specific file that they do not otherwise have access to, right?

I would not give them access to use vi (or emacs or any other real editor) as root. That's a HUGE security hole. Here's a thought:

Create a (normal, non-suid) script. Put it somewhere in their path, e.g., /usr/local/bin. You can even call it sudovi if you like. That script does:
  1. Call a script in /usr/local/sudo to make a copy of the file you want them to edit. (You can allow some parameter here, but if you do, check it carefully to make sure they are not editing something critical like /etc/passwd. :-) )
  2. Let them edit the file as themselves with a simple call to their editor of choice. (I'd prefer to user a line like "$EDITOR $FILE" rather than "vi $FILE" if for no other reason than that I prefer alternate editors myself.)
  3. Copy the edited file back to where it belongs.
Or, instead of copying, I'd probably rename the original to something like original.<timestamp> and then mv the edited file to original. That way you have a record of all the changes. I might even make the backups in the form original.<timestamp>.<user> so you even have a record of who made which changes.

As usual, YMMV. A lot depends on who your users are and why you are doing what you are doing. What works for me may be very different from what works for you.

Best Regards,
Paul
Jan 17 '08 #4
Colloid Snake
144 100+
I meant to hop on earlier and say thanks, but I got pretty busy, and as this wasn't considered a "pressing issue" by management, it fell by the wayside. I'll have to find the time to mess around with it, but thank you for the guidance, I'm sure I will be able to figure it out with the above in mind.

Thanks

~Snake
Feb 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Puvendran | last post by:
Hi, We have encountered deadlock on a table which is used to generate sequential numbers for different categories eg typical entries Category Value TRADE_NO ...
3
by: Ryan | last post by:
I have a problem with record locking / blocking within an application. The app is quite straight forward. Written in Delphi 5 using BDE to access a SQL 7 database (Win2K server). Every so often...
375
by: rkusenet | last post by:
This article is very bleak about future of DB2. How credible is the author. http://www.eweek.com/article2/0,1895,1839681,00.asp
2
by: Zri Man | last post by:
I have a situation that is as follows: First an Index of what is discussed below: FED_A ->> Federated Objected/Table that has lots of rows LOC_B ->> Local Table which is selected and...
4
by: Justin | last post by:
I'm writing some custom software for an educational setting. One of the features of the program is locking down students computers to get their attention. To do this I was thinking of something...
7
by: Schroeder | last post by:
I have a DataSet that is cached deep down in a business layer object. Higher up, there's a merge being performed on that object and it very occassionaly throws a NullReferenceException deep down in...
8
by: Corey B | last post by:
I am writing a web application in ASP.NET that allows a user to download an XML file to their machine that contains all of their work. Then later they can upload that file to the server and...
1
by: Mark S. | last post by:
Hello, My c# aspx 2.0 web application has a static class. I would like to add a dataTable to it and have the heavy load (+100 requests a second) update it's values. This is the first time I used...
1
by: ABrown | last post by:
Hello, I have a 2003 database set up with about 20 users (only about 4 at a time) but I repeatedly get a problem with the records all locking. Each User is assigning billing codes to jobs so they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.