Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 04-19-2012, 05:20 AM   #1
Registered: Apr 2004
Posts: 682

Rep: Reputation: Disabled
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?

Old 04-19-2012, 05:30 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
not with sudo, I'd suggest looking at writing a script to work this stuff out, and let them run the script from sudo.
Old 04-19-2012, 02:19 PM   #3
Senior Member
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,296

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: The Ultimate Sudo FAQ To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
[SOLVED] differences between shell regex and php regex and perl regex and javascript and mysql golden_boy615 Linux - General 2 04-19-2011 01:10 AM
Perl to find regex and print following 5 lines after regex casperdaghost Linux - Newbie 3 08-29-2010 08:08 PM
regex with sed to process file, need help on regex dwynter Linux - Newbie 5 08-31-2007 05:10 AM
Need a regex, I suck at regex's d3funct Programming 4 02-25-2002 08:28 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:57 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration