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 you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Your .profile is only read when you log in interactively. When rsync connects to another machine to execute a command, /etc/profile and ~/.profile are not read.

If your login shell is bash, then ~/.bashrc may be read (this is a quirk of bash — ~/.bashrc is read by non-login interactive shells, and in some circumstances by login non-interactive shells). This doesn’t apply to all versions of bash though.

The easiest way to make rsync work is probably to pass the --rsync-path option, e.g.

rsync --rsync-path=/home/elbarna/bin/rsync -avP /home/user/.profile hpux3:/home/user/.profile

If you log in over SSH with key-based authentication, you can set the PATH environment variable via your ~/.ssh/authorized_keys. See sh startup files over ssh for explanations of how to arrange to load .profile when logging in over SSH with a key.

Method 2

This error can also occur when trying to sync files and directories from remote machine to local system, if the rsync is not installed on the remote side.

rsync -zarvh <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="640b0109245553564a56544a544a5556">[email protected]</a>:/var/www/html/release /var/www/html/release
bash: rsync: command not found

Installing rsync on remote side will solve this case


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x