LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-12-2014, 01:37 PM   #1
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
Sudo access to a directory(Read)


I want to set user zamo to have read only access to the directory /var/log/autosys and the directory below that .

will my below settings in /etc/sudoers work ? Not to add the user to the directory group .I want to do that using sudo only .


Code:
User_Alias     MYGROUP = zamo
MYGROUP, %autosys ALL= /var/log/autosys/*
 
Old 03-12-2014, 02:06 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You can change the permissions of subdirectories of /var/log (but not /var/log itself) without causing issues in future updates.

Given that you could just make /var/log/autosys readable by everyone (chmod 755) or you could put a different group on that directory and add zamo to that group.

If you don't want to muck with the group you could use ACLs instead to add just zamo.

I don't think sudo would be a good tool for this especially when you're talking about "reading" files. I've seen far too many admins give something silly like "sudo vi /var/log/autosys/*" to a user without understanding that the sudo is running the vi as root so simply typing ":!/bin/sh" in the sudo vi session puts the user into the shell as the root user. Once they've done that you might as well have just given them the root password as they just became root.
 
Old 03-12-2014, 02:07 PM   #3
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Why use sudo?

You can probably do this with ACLs

Code:
setfacl -m user:zamo:r-x  /var/log/autosys
setfacl -R -m user:zamo:r--  /var/log/autosys/*
--C
 
1 members found this post helpful.
Old 03-12-2014, 02:26 PM   #4
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
Thanks for the update and suggestions
 
  


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
sudo access for a user to read mail files slufoot80 Linux - Newbie 1 05-06-2013 04:10 PM
mkdir: cannot create directory: Read-only file system (Tried sudo and chmod) AsoInfo Linux - Newbie 4 11-28-2012 01:12 AM
Accessing users home directory with sudo access..How to block this ? sujithspillai90 Linux - Newbie 1 04-20-2012 07:25 AM
[SOLVED] Using sudo to give read access to specific directory savona Linux - Security 14 01-31-2012 10:50 AM
Grant certain group read-only access to /var directory loadedmind Fedora 5 06-14-2010 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:05 PM.

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