[sf-lug] permissions problem
Daniel Gimpelevich
daniel at gimpelevich.san-francisco.ca.us
Sat May 27 20:20:49 PDT 2017
On Sat, 2017-05-27 at 20:16 -0700, Alex Kleider wrote:
> $ sudo echo "added line" >> junk
> -bash: junk: Permission denied # why didn't sudo allow me to do the
> job?
>
> I don't understand why the last command didn't go through.
It's because the ">>" is given to the bash instance in which you're
typing it, rather than to sudo.
> Has anyone a suggestion why and (more importantly) how to add a line
> to
> a privileged file? I suppose I could temporarily change ownership but
> that seems a long way round.
> tia
$ echo "added line"|sudo tee -a junk >/dev/null
yw
More information about the sf-lug
mailing list