[sf-lug] permissions problem

Alex Kleider akleider at sonic.net
Sat May 27 20:28:53 PDT 2017


Thanks, Daniel. Much appreciated.

On 2017-05-27 20:20, Daniel Gimpelevich wrote:
> 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
> 
> 
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
> Information about SF-LUG is at http://www.sf-lug.org/<br>
> Related Information <br>
> http://www.shallowsky.com/blog/<br>
> http://explainshell.com/ <br>



More information about the sf-lug mailing list