I sshed to a remote machine and want to copy some files from there to my local machine. Both are running linux. My local machine is behind a firewall, so I can't do "scp file_on_remote user@localmachine". I know I can do "scp user@remotemachine:/directory/file ./", but I need to wander around on the remote server to pick some files to download to local machine, so this way doesn't seem too appealing to me.
4 Answers
Silly question but can you run a GUI on the client machine, like Filezilla?
Assume you can't and are unhappy with RSYNC or SSH or RSYNC over SSH, then you might want to look into SSHFS. This will allow your to mount a remote directory over SSH to you local box. You can browse and use normal cp or mv to copy or move files around.
-
I should have added a link for you, sorry fuse.sourceforge.net/sshfs.html Commented Mar 13, 2011 at 7:19
-
Thanks. Yeah, this is what I finally chose for the directories I may frequently browse. For some random files, a ssh reverse tunneling will do.– leonbnuCommented Mar 13, 2011 at 19:23
-
after a few days' trial, sshfs drops the connection quite often and then gives me a busy device error when I try to unmount it.– leonbnuCommented Mar 18, 2011 at 18:27
Use rsync: http://rsync.samba.org/
-
2While rsync is a good answer. It is nice if you extrapolate a little on your answer as well. Why is rsync better then the op's idea? Commented Mar 13, 2011 at 5:40
-
RSync requires a significant amount of study of its command-line switches to use it effectively in each environment. It is a common solution that works well for file/directory replication as it was designed for this purpose. Commented Mar 14, 2011 at 1:28
if you are able to scp user@remotemachine:/directory/file ./
then why don't you
rsync -avl user@remotemachine:/direcory/ ./directory/ --include=/etc/ --include=/home --exclude=/tmp/
that command can even clone the entire machine, and you can make the target also bootable after a few file modifications.