SPUG: Inspired, broken.

jlb jlb at io.com
Wed Feb 9 13:44:18 PST 2005

On Wed, 9 Feb 2005, Tim Maher wrote:

> On Wed, Feb 09, 2005 at 01:27:48PM -0800, Atom Powers wrote:
>> This doesn't work: ( I apologize for the line breaks )
>> apowers at hermes0:/home/mailman> sudo -u mailman perl5 -wnl -e
>> 'm/\w+\@\w+\.\w{3}/ and print "\L$&\E OK";' address_list.txt >
>> recipients.txt
>> recipients.txt: Permission denied.
> Apparently the mailman ID is attempting a write to the
> current directory, and it doesn't have permission there,
> so use a directory it can write to; for example:

Actually, he's not writing the file as mailman.  The redirection happens 
in his currently running shell, I'm pretty sure, not underneath sudo. 
It's the output of sudo he's redirecting, which happens as his current 


jburdge at qadev ewa $ sudo /bin/bash -c '/bin/echo foo' > bar
jburdge at qadev ewa $ sudo /bin/bash -c '/bin/echo foo > foo'
jburdge at qadev ewa $ ls -al foo bar
-rw-r--r--  1 jburdge users 4 Feb  9 13:35 bar
-rw-r--r--  1 root    root  4 Feb  9 13:35 foo
jburdge at qadev ewa $

Properly quoted, he could probably do what he's trying to do now, or he 
could do what you suggested.

More information about the spug-list mailing list