LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-13-2014, 09:49 AM   #1
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Rep: Reputation: 3
sudo config question ...


is there a way i can give someone full sudo BUT restrict them from viewing one specific file?

a client of ours is requesting full access to their server, but i do not want them to have R rights to the /root/.ssh/authorized_keys file.

what's the recommended course of action for this?
 
Old 01-13-2014, 10:19 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by socalheel View Post
is there a way i can give someone full sudo BUT restrict them from viewing one specific file?

a client of ours is requesting full access to their server, but i do not want them to have R rights to the /root/.ssh/authorized_keys file.

what's the recommended course of action for this?
You'll have to have a pretty comprehensive rule set for that user. First, deny them shell access, then deny them rights to cp/mv/cd/whatever-else-can-read-a-file to that file/directory. And that is a LONG list (tar, gzip, zip, cpio, etc., etc....). Then also deny them rights to run whatever backup software you use, so they can't RESTORE that file to an alternate location.

Short answer: it's doable.
Long answer: it's doable, but not practical. There are FAR too many commands to copy/read files, and that doesn't take into account if that user writes a shell script that USES one of those commands, and runs IT with sudo, which may let them sidestep things.

Most practical solution: Warn user(s) that they are NOT to play with that file, and get them to sign a sheet showing you've had this talk with them. Deny shell access and limit login hours for that user to working-hours only. Have a cron job run every so often, to look at the sudo logs for anything that mentions that directory/file. Email the data security/admins if such an entry is found, and show up at that users desk IMMEDIATELY with a baseball bat, and ask them what the hell they think they're doing. Fire said employee if the warning doesn't work.
 
1 members found this post helpful.
Old 01-13-2014, 11:20 AM   #3
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by TB0ne View Post
You'll have to have a pretty comprehensive rule set for that user. First, deny them shell access, then deny them rights to cp/mv/cd/whatever-else-can-read-a-file to that file/directory. And that is a LONG list (tar, gzip, zip, cpio, etc., etc....). Then also deny them rights to run whatever backup software you use, so they can't RESTORE that file to an alternate location.

Short answer: it's doable.
Long answer: it's doable, but not practical. There are FAR too many commands to copy/read files, and that doesn't take into account if that user writes a shell script that USES one of those commands, and runs IT with sudo, which may let them sidestep things.

Most practical solution: Warn user(s) that they are NOT to play with that file, and get them to sign a sheet showing you've had this talk with them. Deny shell access and limit login hours for that user to working-hours only. Have a cron job run every so often, to look at the sudo logs for anything that mentions that directory/file. Email the data security/admins if such an entry is found, and show up at that users desk IMMEDIATELY with a baseball bat, and ask them what the hell they think they're doing. Fire said employee if the warning doesn't work.
good write-up man, i figured it was doable but i was hoping it would have been as simple as putting a "!/etc/.ssh/authorized_keys" comment or something similar in the sudoers file.

i appreciate your input.

i've given the client /bin/sh access but did not put an entry in the /etc/sudoers file. They said they are fine with just having ssh access for now and if they need any elevated privileges, they'll let me know specifically what and for which file they need.
 
Old 01-13-2014, 04:43 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you do end up having to give them more access than you want, in addition to TB0ne's excellent advice above, this will come in useful http://linux.die.net/man/1/inotifywait
 
1 members found this post helpful.
  


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
Question about the sudo command, specifically how to have sudo act as if user is root slacker_ Linux - Newbie 17 09-22-2013 03:48 PM
sudo config file? gangsta77 Linux - General 2 03-02-2011 11:12 AM
Debian, kdm config as sudo b1f30 Linux - Desktop 4 12-16-2008 01:49 PM
LXer: sudo, or not sudo: that is the question LXer Syndicated Linux News 0 02-07-2008 05:40 PM
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:10 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