LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 03-09-2016, 03:34 PM   #1
ahmerj123
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Rep: Reputation: Disabled
Question Sudoers File


Hi All,

Question: Is there a way in the sudoers file to restrict access to a certain directory?, I know the sudoers file is used to manage permissions on how much privileges in terms of commands. The user needs root access, but we want to restrict an access to certain directories.

Thanks,
Ahmer

Last edited by ahmerj123; 03-10-2016 at 07:47 AM.
 
Old 03-10-2016, 09:14 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi there,

What does the user need to do in these directories? You might be able to either use chroot to restrict them to a directory, or wrap the command(s) they need in a script that allows only the authorized actions.
 
Old 03-10-2016, 09:16 AM   #3
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
I'm for the chroot approach.
 
Old 03-10-2016, 12:04 PM   #4
Hasek39
Member
 
Registered: Jul 2015
Location: Pittsburgh, PA, US
Distribution: Slackware
Posts: 120

Rep: Reputation: Disabled
Maybe you can chown this directories to another user?
 
Old 03-19-2016, 12:50 AM   #5
ahmerj123
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
So the problem is that they are engineers and need to install software and make system changes to make this software build that they install work. As system admins we dont know their required commands. So we are trying to make a setting that allows all root access without them explicitly changing permissions and accessing certain directories.. Certain parts of /etc
 
Old 03-19-2016, 12:51 AM   #6
ahmerj123
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Root has full access to everyone and sudoers lets you become root without the actual root passwd.
 
Old 03-21-2016, 10:47 AM   #7
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by ahmerj123 View Post
Root has full access to everyone and sudoers lets you become root without the actual root passwd.
Correction, sudoers allows you to run commands as root. There are ways to become root if you have sudoers rights.
 
Old 03-21-2016, 06:20 PM   #8
ahmerj123
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by lazydog View Post
Correction, sudoers allows you to run commands as root. There are ways to become root if you have sudoers rights.
So is there a way to make it so users with sudoers privileges can not access other home directories and restrict access to directories like Audit.
 
Old 03-21-2016, 08:32 PM   #9
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
OpenVZ with ploop storage.

My favorite way to approach that is using Linux containers (either LXC or OpenVZ) to give each engineer a virtual machine. Even better than chroot, each has what looks like an entire linux workstation with complete access to ALL files - yet they cannot affect the virtual machine of the next engineer or see ANY of his (or her) files. Just as they are walled away from each other, they are also walled away from the host (DOM0) physical server.

As a side benefit, it is fairly easy to take a working container and use it to make a template that can be used to deploy multiple copies as needed. So if they get it REALLY right, they can safely share with all of the other engineers.

Last edited by wpeckham; 03-21-2016 at 08:35 PM.
 
Old 03-22-2016, 09:05 AM   #10
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by ahmerj123 View Post
So is there a way to make it so users with sudoers privileges can not access other home directories and restrict access to directories like Audit.
That all depends on what you have already setup. For example are the directories already setup to not allow them access as normal user? If so then you would remove the ability to run the 'cd' command as sudo.

But if you want to restrict the users use of commands they can use you should lock all commands and only allow the commands you want them to use.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] User not in sudoers: How to add user? Permtion Denied for sudoers file esgol Linux - Newbie 3 07-13-2012 07:44 AM
Fedora /etc/sudoers file and sudoers.d directory davejjj Linux - Newbie 2 10-21-2011 06:19 PM
Sudoers File Help Harlin Linux - Software 1 03-15-2006 04:16 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM
help with sudoers file ogden2k Linux - Security 4 03-11-2003 10:39 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration