10

When the rsync program is invoked over ssh what does the interaction between rsync and ssh look like? What feature of ssh is rsync using? I am interested in the interaction between rsync and ssh.

1 Answer 1

14

ssh provides a connected stream from the local system running your rsync to another instance running on the remote server. The local rsync starts it as part of the ssh connection process - it is not the same instance of rsync that might be running as a daemon on that remote server.


What is an ssh stream?

An ssh stream is what you use when you ssh to a remote system. You might prefer to call it an ssh session. That's fine. As an example, ssh [email protected] would connect you to that remote system and give you an interactive session. Anything you typed locally would be received and actioned remotely, and anything generated remotely would be presented to you locally.

Similarly, ssh -t [email protected] vi /etc/hosts would set up a connection to run vi /etc/hosts on the remote system as if you were using it locally. (The -t flag tells ssh to ensure that the remote command, vi, is run on a pseudo-terminal; otherwise it would skip that layer of complexity.)

Now, for rsync, the connection is set up by the local instance with something like ssh [email protected] rsync --server -nlogDtpre.iLsf {local_path} {remote_path}. This allows the local rsync to talk with the remote rsync over a connection just like you would use to access that same remote server. The remote instance of rsync knows it's a server because of the flags it has been provided when started by the local instance.

You can see how rsync has been called remotely by running something like ssh [email protected] 'ps -ef | grep [r]sync' while the rsync is in progress.

Why not just have rsync talk directly without ssh?

The advantage of using ssh is twofold

  1. It is a well known protocol and the mechanisms for authentication and logging in to a remote system are well understood (by those who need to understand it) and trusted
  2. It provides a secure and encrypted channel over which any sensitive data can be safely passed. Without this layer rsync would either have to implement its own encryption or ignore the issue. Both are hazardous in today's Internet connected world.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .