Its often undesirable for InfoSec reasons and/or a productivity killer to use root to ssh|scp|rsync
to other nodes.
There seem to be a number of sources of knowledge online about rsync'ing
when you have sudo
rights on the remote dst node aka "the receiver", but I didn't find a good answer when you also want to use sudo
on the local src node aka "the sender".
Typically once you've sudo rsync
on the sender node, the env is changed to the sudo user e.g. root and previous session authentication mechanisms are lost.
For example if you have barrier free ssh
and sudo
access to your internal systems with your own user because of already satisfying MFA on the perimeter, and you're using ssh keys and/or Kerberos tickets to persist authenticated sessions, it can be a real PITA to be forced to use a different user to ssh|scp|rsync
.
In related news root is often restricted for good InfoSec reasons via sshd_config
directive `PermitRoo