Sudo Permission cat, echo at root folder

When you run sudo with a command, only the command and parameters are privileged. A pipe transfers data from one command to another command, e.g. |, < or >.

Works:

print 'root' | sudo tee /etc/config
sudo sh -c 'echo "root" >/etc/config'
2 Likes