Why is PATH reset in a sudo command?

After much frustrating head-brick-wall contact, I’ve discovered this: $ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/steve/bin $ sudo bash # echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin but $ sudo bash -c 'echo $PATH' /sbin:/bin:/usr/sbin:/usr/bin $ sudo bash -Ec 'echo $PATH' /sbin:/bin:/usr/sbin:/usr/bin I gather from another post that the sudo path is read from /etc/sudoers — but why? Does setting $PATH in /root/.profile … Read more

Why is rsync not found?

rsync -avP /home/user/.profile hpux3:/home/user/.profile bash: rsync: command not found If I did ssh to hpux3 machine rsync version 3.1.1 protocol version 31 Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ output truncated I have set PATH in $HOME/.profile and $HOME/.bashrc. Should I set it in the /etc/profile file? Answers: Thank … Read more