Re: redirecting out of a command invoked by sudo fails

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

 



JD wrote:
> cd /var/lib
> sudo tar cjf - rpm > rpm.tar.bz2
> sh: rpm.tar.bz2: cannot create [Permission denied]

Why use f - and then redirect stdout when you could just do:

sudo tar cjf rpm.tar.bz2 rpm

?

> Is this an established legacy behaviour of sudo?

This is the way it has always been and will always be.

If you do find other cases where you need this sort of thing, a common
idiom involves tee:

echo foo | sudo tee /path/to/some/root/owned/file > /dev/null

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We are not to expect to be transported from despotism to liberty in a
featherbed.
    -- Thomas Jefferson

Attachment: pgpydJRw7zLZq.pgp
Description: PGP signature

-- 
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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux