Why does rsync read .bashrc and not .profile?

rsync is a non-interactive program that logs into other machines. It shouldn't need the init file for an interactive shell session, and it should absolutely need the init file for a login shell. Or so I would think.

Yet .bashrc gets read and .profile does not (unless I make .bashrc itself read .profile). Why?


rsync itself does not read your ~/.bashrc. But it calls ssh targethost rsync ..., which will connect to an sshd, which in turn will start your shell (bash).

Why that bash now reads your ~/.bashrc is explained in Why does my .bashrc get read when I run noninteractive commands over ssh