Copy from remote server which doesn't have rsync
Solution 1
If you have the permission to use FUSE on your local machine, install the sshfs
package. SSHFS lets you access remote files via normal filesystem access: it mounts a directory tree accessed over SFTP. You only need to have SFTP access on the remote side (which is enabled by default with OpenSSH on Ubuntu). Once the remote directory is mounted, you can use the tools of your choice to manipulate files, without having to care whether they're local or remote.
mkdir ~/net/remote-server
sshfs remote-server:/ ~/net/remote-server
rsync -a --no-copy-links ~/net/remote-server/remote/path/ /local/path/
fusermount -u ~/net/remote-server
Solution 2
You can use scp -r
to copy files recursively between different hosts. Your syntax could be like scp -r user@Ubuntu-Server:/home/myuser ./from_Ubuntu_server
Besides, you might be able to upload your local rsync
binary using scp to the Ubuntu server and add the --rsync-path=/home/myuser/rsync
to your original rsync
command to let your client rsync
know which rsync
it should invoke on the Ubuntu server.
Solution 3
You can use tar
and ssh
.
As an example, to upload the contents of a local directory somewhere_local
, via ssh, to the path /somewhere
tar czf - -C ./somewhere_local . | ssh {yourserver} 'tar xzf - -C /somewhere'
Alternatively, to download the contents of a remote directory /somewhere
, via ssh, to the path ./somewhere_local
ssh {yourserver} "tar czf - -C /somewhere ." | tar xzf - -C somewhere_local
Related videos on Youtube
BowPark
Updated on September 18, 2022Comments
-
BowPark over 1 year
I need to recursively copy a folder from a Ubuntu remote server where I have
ssh
access. I don't want to follow symbolic links, nor to copy permissions/owner/group, because my client system (Ubuntu too) doesn't have the same users as the server.This
rsync
solution could be the best one. But the server does not haversync
and I can't install it there; so that command gives me error.Is there another way to copy the remote folder?
-
Admin almost 9 yearstar or cpio ... these do have limitations but they copy symlinks as symlinks
-
Admin almost 9 yearsor upload your own copy of the
rsync
executable ... it does not need root permissions to work your own files
-
-
Kenster almost 9 yearsThere's nothing in the question which suggests the OP needs to use sudo.
-
dave_thompson_085 almost 9 yearsThat copies local to remote; it should be reversed
ssh @remote "tar cf- from" | tar xf-
for this question. Bothtar z
andssh -C
is almost certainly a waste of CPU; even one is needed only if large data or slow net. Usingv
on both concurrent tars will often produce very confusing output; I would do it only on the destination. -
bhu Boue vidya over 7 yearsyour tip on using
--rsync-path=/...
helped me on my remote host where i was able to easily compile my own copy ofrsync
from source, and point to it from local rsync cmd. worked a treat! thx sooooooo much....