Why use tee with wget? Isn't it superfluous?

Solution 1:

The difference is that you don't execute wget with elevated privileges. It allows you to decrease the attack surface.

  • | sudo tee command executes wget with regular privileges and uses elevated privileges only to write data into a selected file.
  • With sudo wget, wget vulnerabilities can be exploited with the elevated privileges.