LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Grant read-only access to users using visudo? (https://www.linuxquestions.org/questions/linux-newbie-8/grant-read-only-access-to-users-using-visudo-4175457718/)

BCC 04-10-2013 03:38 PM

Grant read-only access to users using visudo?
 
I would like to grant read only access to all files for one user on a Linux server (CentOS 6.3). VISUDO is what looked promissing, but after a couple hours of searching it has yielded no results other than to be able to grant full access. Does anybody know if this can be done? Thank you.

TB0ne 04-10-2013 04:10 PM

Quote:

Originally Posted by BCC (Post 4929269)
I would like to grant read only access to all files for one user on a Linux server (CentOS 6.3). VISUDO is what looked promissing, but after a couple hours of searching it has yielded no results other than to be able to grant full access. Does anybody know if this can be done? Thank you.

Well, visudo is one command, that is used to set up the sudoers file. That command only does that ONE thing, so I'm not sure why you thought it would do anything related to file permissions.

That said, *MOST* of the files on your system are probably readable to a 'regular' user anyway, with the exception of a very few. If all you want the user to be able to do is look at the contents of files, then grant them root access to the 'cat' command only, in the sudoers file, like this:
Code:

usersname ALL=/usr/bin/cat
That should let them look at any file on the system, but not change anything. However, if you don't trust this user to make changes, you should not trust them with being able to read all the files, or escalated privileges AT ALL.

BCC 04-10-2013 04:26 PM

Quote:

Originally Posted by TB0ne (Post 4929291)
Well, visudo is one command, that is used to set up the sudoers file. That command only does that ONE thing, so I'm not sure why you thought it would do anything related to file permissions.

That said, *MOST* of the files on your system are probably readable to a 'regular' user anyway, with the exception of a very few. If all you want the user to be able to do is look at the contents of files, then grant them root access to the 'cat' command only, in the sudoers file, like this:
Code:

usersname ALL=/usr/bin/cat
That should let them look at any file on the system, but not change anything. However, if you don't trust this user to make changes, you should not trust them with being able to read all the files, or escalated privileges AT ALL.

Thank you very much. I fully understand and appreciate your expressed concern about exentding privileges in this way. It is temporary.

jpollard 04-10-2013 04:30 PM

It also lets them destroy your system.

You have to disable exec.


All times are GMT -5. The time now is 06:39 PM.