vendredi 26 décembre 2014

Can I make a file only accessible to a script, and not a user?


I have a user with limited access on the system (that is, he is not a sudoer); let's call him Bob.


I have a script or a binary which I, the system administrator, trust, and would have no problems running it as root; let's call the script print-log.sh. The job of this script is to read data from a "private" (owned by a user/group other than Bob, or even root) file located in /srv/secret-log, and only output lines from that file that a user has clearance to read (let's say this is "government style" clearance level, unrelated to whatever permissions users may have in their Unix system).


The file /srv/secret-log is protected by Unix permissions, so users like Bob are not allowed to access the file directly. They are, however, allowed to run the print-log.sh script, which is allowed to access the file and return the "filtered" data to Bob.




To summarize (the TL;DR version):



  1. Bob can't read the protected file

  2. The script can read the protected file

  3. At any time, Bob can run the script which can read the file


Is it possible to do this within Unix file permissions?



Aucun commentaire:

Enregistrer un commentaire