Possible Duplicates:
How to append to a file as sudo?
sudo unable to write to /etc/profile

The following command does not work because the elevated privileges do not apply to the redirection.

sudo echo "myoutput" >> /etc/file_that_only_root_can_write

how can it be done?

link|improve this question
1  
superuser.com/questions/54814/… – akira Jun 23 '10 at 11:36
@akira you're probably right... I just started a new one because I didn't find those. – João Portela Jun 23 '10 at 14:34
feedback

closed as exact duplicate by akira, quack quixote Jun 23 '10 at 19:14

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

1 Answer

up vote 5 down vote accepted
echo "myoutput" | sudo tee -a /etc/file_that_only_root_can_write
link|improve this answer
that it! thanks. – João Portela Jun 23 '10 at 14:33
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.