tvl-depot/users/wpcarro/website/blog/posts/tee-time.md
William Carroll 5188c689bf feat(wpcarro/blog): Short notes post on sudo tee
See post for more information :)

Change-Id: I1e2c1e3997d895fd64f225b5f0bc91f5b26d3e96
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5940
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
2022-07-12 04:01:20 +00:00

360 B

I encountered this fun TIL while troubleshooting Linux write permissions issues...

TL;DR

Don't do this (unless you want misleading test results):

λ sudo -u node-exporter echo 'Hello, world' >/var/lib/textfile-exporter/test.prom

Do this:

λ echo 'Hello, world' | sudo -u node-exporter tee /var/lib/textfile-exporter/test.prom