How is SSH/scp/rsync encrypted?

4

And, just making sure I have this right, if I copy a file from a server with this command:

$  rsync  mvmacd@ssh.mysite.com:~/credit_card_numbers.txt ./

[Not that I actually have that file on my server--just an example of confidential docs x-D ]The .txt file [or any kind of file] would not be sent in plaintext, but would be encrypted? With my Key file or something in ~/.ssh, right? And nobody snooping on the connection [gov, people on my network, etc etc] would be able to view the file?

Matt

Posted 2011-08-06T14:32:26.913

Reputation: 627

Answers

5

A randomly generated, symmetric session key is used for encrypring the communication between client and server. During the connection the key is shared by both parties, when the session ends, the key is destroyed.

SSH version 1 (SSH-1) uses only a single key, while SSH-2 has several: each direction (client->server, server->client) and others for integrity checking.

SSH-2 provides a way for either side of an SSH connection to initiate a re-keying ("Session rekeying"), causing client and server to negotiate new session keys.

Source: O'REILLY - SSH The Definitive Guide

As EightBitTony mentioned, use scp.

Milde

Posted 2011-08-06T14:32:26.913

Reputation: 1 109

1rsync uses SSH as the default transport as of release 2.6.0 (January 2004). [No self-respecting distributor would change this to something insecure.] – user1686 – 2011-08-06T18:53:46.127

1And no self respecting sysadmin would assume it was using ssh, when you can just stick -e ssh in and be sure. – EightBitTony – 2011-08-06T23:21:05.527

4

rsync might not be encrypted. It usually runs over ssh by default (and hence is encrypted) if it's not talking to an rsync server, but it might have been configured / compiled to use rsh or some other remote shell.

ssh (and scp, which runs over SSH) is encrypted using public/private key encryption, nothing that travels over the connection can be interpreted without access to the private keys. People are prevented from not only reading the contents of the file, but from knowing you're even transferring one, they can just see encrypted traffic.

To be sure, you can use,

rsync -e ssh .....................

EightBitTony

Posted 2011-08-06T14:32:26.913

Reputation: 3 741