Check syntax of an arbitrary sudo-file (one you might want to put into the
visudo -cf sudoers.test
The following grants root priveleges to the user johndoe, allowing him to execute anything as root via
sudo, without beeing asked for a password.
johndoe ALL=(ALL) NOPASSWD: ALL
Pipe - or Redirect Output
If you need to redirect output oder pipe commands together you can make it work with a subshell:
sudo sh -c 'ls -la /root/ > /root/ls.txt'
SSH Agent Forwarding with Sudo
If you want to use your current user's SSH agent forwarding with sudo (to become root) this is one possible way to do this:
visudo -f /etc/sudoers.d/05_root
This way root (and only root) is allowed to reuse your SSH agent socket while you sudo. This will greatly enhance your sudo-experience