LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   sudo regex (https://www.linuxquestions.org/questions/linux-server-73/sudo-regex-940632/)

noir911 04-19-2012 05:20 AM

sudo regex
 
I would like to give sudo access to a user to tar gzip a website. The only issue is the destination directory where the file should be gzipped is not fixed and also the gzip file name also need to be appended with YYYYMMDD. Is there any way to do this?

Thanks.

acid_kewpie 04-19-2012 05:30 AM

not with sudo, I'd suggest looking at writing a script to work this stuff out, and let them run the script from sudo.

wpeckham 04-19-2012 02:19 PM

Well actually ...
 
1. The date thing is easy and can be done on a command-line - that part does not require a script.
2. The floating target is more of an issue, it would be best to pin down the target directory so it does not change.

You might give them sudo permissions to run a script (and nothing else) but that is only secure if the script cannot change. Placing it on a read-only partition (cd perhaps) might be wise. Restrict the file name to something hard-coded in, but let it request the folder location from the user.

Make sure that your script evaluates the input to ensure that the folder exists, it does not overwrite an existing file, and that the user is not making a typo that could get someone fired.


All times are GMT -5. The time now is 09:26 PM.