CH-J Server Managerserver management over SSH
Menu
All guides and articles →

SFTP transfer between two Linux servers without SCP

Copy files between two remote servers through your own computer, handle conflicts and verify the result with SHA-256.

Two ways to move data between servers

Either one server connects directly to the other, or your own computer relays the data between them. A direct connection is usually faster, but the source needs network access to the target and credentials for it, which you may not want to leave on a server. Relaying needs neither: only your computer holds the credentials, and the servers do not have to reach each other. The cost is that all data passes through your connection.

Relay from the command line

The -3 option of scp copies between two remote hosts through the local computer. It is useful for a single copy but gives you no queue, and if the transfer breaks you run it again yourself.

scp -3 admin@source.example:/srv/data/archive.tar.gz admin@target.example:/srv/data/

Verify the copy

Before deleting anything on the source, compare a checksum on both servers. Matching SHA-256 values show that the file arrived intact. Equal file sizes alone do not prove that.

ssh admin@source.example sha256sum /srv/data/archive.tar.gz
ssh admin@target.example sha256sum /srv/data/archive.tar.gz

Decide about conflicts in advance

Before a larger transfer, decide what should happen when the file already exists on the target: overwrite it, keep both or skip it. Check free space on the target and permissions on the target directory. Copying as an ordinary user does not preserve the owner of the files, so a restored application may need its ownership corrected afterwards.

Two panels in CH-J Server Manager

In Alpha 0.1.1 the File Manager has one to three panels, and each shows the local disk or any open SSH session. Copy or move files between panels with the keyboard, by dragging or from the context menu. Data streams from one SFTP session to the other through your computer without being stored on its disk, and transfers use a queue with pause, resume, cancel and conflict handling. When moving, the source file is deleted only after its SHA-256 matched and only if it has not changed.

Limits to expect

The transfer is not direct, so its speed depends on your own connection to both servers, and your computer has to stay connected. Files readable only with sudo cannot be copied between servers this way. Beta 0.1.0 does not include the multi-panel File Manager.

Detailed documentation

OpenSSH: sftp →

OpenSSH: scp (-3) →

Biometric unlock and security →