Is there a quick way of copying files "up" an SSH connection?
June 2, 2008 6:56 AM
Subscribe
Is there a quick way of copying files "up" an SSH connection?
Say I'm logged into a remote machine and have navigated to some inconveniently deep location in the directory structure, where I find a file I want to copy back to the local machine from which I established the SSH connection.
However, the local machine is not visible from the public internet so I either have to set up a port forward on the router it lies behind (and perhaps a DynDNS alias) and scp from the remote machine, or log out/start a new terminal on the local machine and issue an scp command from there, referring to the aforementioned inconveniently deep location of the file.
It seems like there should be a more ad hoc, easier way to copy a file back up an SSH connection. Is there?
posted by caek to computers & internet (15 comments total)
8 users marked this as a favorite
Having said that, if you've got sshd running on your local machine, you could set up a port forward when you establish your ssh connection (e.g. map remote port 5000 to local sshd port) so when you find a file you want to copy, just use scp -P 5000 yourfile localhost:/pathonlocalmachine.
Be warned that tunneling SSH over SSH has generally sucky performance. If you've got an FTP server running locally the same trick would work (forward a remote port to your local ftp port) and you can just use something like ncftp to copy files in an ad-hoc fashion.
If you're feeling brave, try setting up an nfs/samba mount over the tunnel instead so you can just copy files to a mounted NFS path on the remote machine and have them magically appear locally.
posted by tkbarbarian at 7:09 AM on June 2, 2008