Transfer files with SCP

Transfer files with SCP

Use an approved SSH endpoint and verify its host key before transfer. Prefer a named key with restrictive permissions.

chmod 600 ~/.ssh/id_ed25519_transfer
scp -i ~/.ssh/id_ed25519_transfer user@approved-host:/path/to/file /local/destination/

To copy a directory recursively:

scp -r -i ~/.ssh/id_ed25519_transfer user@approved-host:/path/to/folder /local/destination/

Verify integrity when a source checksum is available:

shasum -a 256 /local/destination/file

Do not use StrictHostKeyChecking=no. If a host key changes, stop and confirm the change through a separate trusted channel.