I want to save output of command to a file that my current user do not have access to. But my user can have root access using sudo.
I'm running for example:
sudo crontab -l > /var/BackUp/crontab
-bash: sudo: Permission denied
But I can run just
sudo crontab -l
So I think sudo relevant only to crontab command and as user do not have access to
/var/BackUp/crontab it gives such error.
Is it possible to write output to a file that requires root access under current user?