Whenever you execute redirection of a command run with sudo, the redirection will be performed as the user calling sudo, not as the superuser (or user specified with the sudo -u flag).
Example:
$ sudo echo letter > /etc/papersize
bash: /etc/papersize: Permission denied
To perform redirection as the superuser (or sudo -u user), place the command in quotes after sh -c.
Example:
$ sudo sh -c 'echo letter > /etc/papersize'
Tuesday, May 12, 2009
Unix redirection with SUDO
Labels:
UNIX
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment