[ale] Redirection using sudo...?
Michael B. Trausch
fd0man at gmail.com
Tue Jun 13 13:11:09 EDT 2006
Okay, so I know that the shell itself implements redirection. This is not a
problem for me, as I use various forms of redirection and piping and such
all the time. However, I have wondered if there is a way to change how
that works.
Sometimes, I want to change something in /proc or /sys. Doing something
like:
$ sudo echo "newvalue" > /sys/something
Will never work, because it says "permission denied" because the redirection
is done as my local user (in this case, fd0man).
There are other solutions -- write a shell script that does it and execute
the entire thing under sudo, or do "sudo su" and then perform the task
using that. Or, even, write a shell script that takes two arguments, the
thing to echo, and the (presumably file) to echo it to. However, I was
wondering if there was some sort of shell construct that can be used on the
command line to be something like:
$ sudo { do something in a subshell as the sudo (root) user; }
I tried simply using a block and that doesn't work, either. Interesting.
Does anybody know if there is such a thing that can be done such that
redirection takes the elevated permissions by default, instead of
redirection as the user running sudo (without creating scripts or using
su)?
Thanks!
Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
More information about the Ale
mailing list