[sudo-users] appending to a root owned file.
DBSMITH at OhioHealth.com
DBSMITH at OhioHealth.com
Mon Jan 10 10:53:51 EST 2005
All,
I was looking in the archives and found some data related to what I want to
accomplish, but not quite.
It told me to :
% sudo sh -c 'echo foo >> /var/log/bar'
With a sudoers entry like:
dude somehost = /bin/sh -c /bin/echo foo >> /var/log/bar
but what I want is to append to /etc/hosts using sudo from with a script
that holds variables.
For example,
dev=172.25.123.123
loc=ISF
id=prt207
sudo echo $dev"\t"$id"\t""#" $loc >> /etc/hosts
but this is given me permission errors.
so then I tried:
sudo sh -c 'echo $dev"\t"$id"\t""#" $loc >> /etc/hosts'
with the line in my sudoers file /usr/bin/sh -c
I am running 1.6.6
Any ideas?
thanks, derek
More information about the sudo-users
mailing list