3

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?

1 Answers1

7
echo "myoutput" | sudo tee -a /etc/file_that_only_root_can_write
Dennis Williamson
  • 106,229
  • 19
  • 167
  • 187