Re: redirecting out of a command invoked by sudo fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 06/25/2010 12:04 PM, Bill Crawford was caught red-handed while writing::
> On 25 June 2010 19:38, JD<jd1008@xxxxxxxxx>  wrote:
>    
>> cd /var/lib
>> sudo tar cjf - rpm>  rpm.tar.bz2
>> sh: rpm.tar.bz2: cannot create [Permission denied]
>>
>> My username is in /etc/sudoers:
>> jd      ALL=(ALL)       NOPASSWD: ALL
>>
>> Yeah... I know it is not safe to set NOPASSWD and all that...
>> but that is not why I am asking about.
>>
>> Is this an established legacy behaviour of sudo?
>>      
> Nope. Just that sudo only runs the "tar" command; the redirect (>) is
> done by the shell, and since you aren't root, you can't write in
> /var/lib.
>
> Suggest "sudo tar cjf rpm.tar.bz2 rpm" (have tar write the file
> itself; it will be running as root so will work).
>    
Makes sense! Thanks for the head up.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux