<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Is there a quick way of copying files "up" an SSH connection?</title>
	<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection/</link>
	<description>Comments on Ask MetaFilter post Is there a quick way of copying files "up" an SSH connection?</description>
	<pubDate>Mon, 02 Jun 2008 07:09:49 -0800</pubDate>
	<lastBuildDate>Mon, 02 Jun 2008 07:09:49 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Is there a quick way of copying files &quot;up&quot; an SSH connection?</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection</link>	
		<description>Is there a quick way of copying files &quot;up&quot; an SSH connection? &lt;br /&gt;&lt;br /&gt; Say I&apos;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. &lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
It seems like there should be a more ad hoc, easier way to copy a file back up an SSH connection. Is there?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.92964</guid>
		<pubDate>Mon, 02 Jun 2008 06:56:35 -0800</pubDate>
		<dc:creator>caek</dc:creator>
		
			<category>ssh</category>
		
			<category>scp</category>
		
	</item> <item>
		<title>By: tkbarbarian</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360709</link>	
		<description>I just use scp from the local machine for this kind of thing (copy/paste are my friend for long paths)...&lt;br&gt;
&lt;br&gt;
Having said that, if you&apos;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.&lt;br&gt;
&lt;br&gt;
Be warned that tunneling SSH over SSH has generally sucky performance. If you&apos;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.&lt;br&gt;
&lt;br&gt;
If you&apos;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.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360709</guid>
		<pubDate>Mon, 02 Jun 2008 07:09:49 -0800</pubDate>
		<dc:creator>tkbarbarian</dc:creator>
	</item><item>
		<title>By: unixrat</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360712</link>	
		<description>Zmodem.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://anirudhs.chaosnet.org/blog/2004.11.07.html&quot;&gt;rzsz&lt;/a&gt; on *nix based systems.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360712</guid>
		<pubDate>Mon, 02 Jun 2008 07:12:55 -0800</pubDate>
		<dc:creator>unixrat</dc:creator>
	</item><item>
		<title>By: unixrat</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360717</link>	
		<description>Ack, wrong link.&lt;br&gt;
&lt;br&gt;
RZ/SZ have been the Zmodem implementations that I&apos;ve used over SSH.&lt;br&gt;
&lt;br&gt;
R = receive, S = send.&lt;br&gt;
&lt;br&gt;
So if you want to send a file to a remote machine, you fire up rz on the remote side and use your term&apos;s sz to send the file.  Vice versa for receiving files.&lt;br&gt;
&lt;br&gt;
1986 represent!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360717</guid>
		<pubDate>Mon, 02 Jun 2008 07:16:45 -0800</pubDate>
		<dc:creator>unixrat</dc:creator>
	</item><item>
		<title>By: unixrat</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360732</link>	
		<description>As long as I&apos;m thinking about it, I might as well keep writing...&lt;br&gt;
&lt;br&gt;
Zmodem supported error checking, resuming interrupted sessions, multiple file transfers, and a few other nice things.  It&apos;s a perfectly cromulent transfer protocol, perfect for the situations that you&apos;ve described - i.e. pulling a file &apos;directly from the terminal&apos;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360732</guid>
		<pubDate>Mon, 02 Jun 2008 07:27:39 -0800</pubDate>
		<dc:creator>unixrat</dc:creator>
	</item><item>
		<title>By: Cat Pie Hurts</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360748</link>	
		<description>Seconding unixrat.  Zmodem is a godsend.  WHen I first transferred a file via Zmodem over an ssh session, I was shocked and amazed; I hadn&apos;t used Zmodem since my old BBS days!&lt;br&gt;
&lt;br&gt;
Also, if you are connecting fom a WIndows system, there are a bunch of different term. emulators that have built in x/y/zmodem support (I used &lt;a href=&quot;http://sourceforge.jp/projects/ttssh2/&quot;&gt;TeraTerm&lt;/a&gt; for years before moving to full *nix).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360748</guid>
		<pubDate>Mon, 02 Jun 2008 07:35:08 -0800</pubDate>
		<dc:creator>Cat Pie Hurts</dc:creator>
	</item><item>
		<title>By: Eater</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360750</link>	
		<description>&lt;a href=&quot;http://zssh.sourceforge.net/&quot;&gt;ZSSH&lt;/a&gt; is SSH with Zmodem file transfer capability wrapped in.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360750</guid>
		<pubDate>Mon, 02 Jun 2008 07:36:57 -0800</pubDate>
		<dc:creator>Eater</dc:creator>
	</item><item>
		<title>By: lubujackson</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360777</link>	
		<description>&lt;a href=&quot;http://filezilla-project.org/download.php&quot;&gt;Filezilla&lt;/a&gt; is an FTP program that lets you connect over SSH.  Maybe not what you&apos;re looking for, but certainly useful for file transfers when FTP isn&apos;t an option.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360777</guid>
		<pubDate>Mon, 02 Jun 2008 07:57:05 -0800</pubDate>
		<dc:creator>lubujackson</dc:creator>
	</item><item>
		<title>By: a robot made out of meat</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360868</link>	
		<description>The &lt;code&gt;sftp&lt;/code&gt; command in another tab.  Just highlight the &lt;code&gt;pwd&lt;/code&gt; and cd to that directory.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360868</guid>
		<pubDate>Mon, 02 Jun 2008 09:01:32 -0800</pubDate>
		<dc:creator>a robot made out of meat</dc:creator>
	</item><item>
		<title>By: grouse</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360874</link>	
		<description>I found I had to do this &lt;em&gt;all the time&lt;/em&gt; created a couple of scripts do this. It works somewhat like the Windows Explorer file clipboard capability. Run the &lt;kbd&gt;pickup&lt;/kbd&gt; command on the file you are interested in remotely. Then run &lt;kbd&gt;dropoff remotehost&lt;/kbd&gt; locally, and it will be copied to your current directory, inconveniently long pathname and all.&lt;br&gt;
&lt;br&gt;
Do this on both systems in a directory that is in your PATH, such as ~/bin:&lt;blockquote&gt;&lt;code&gt;cat &amp;gt; dropoff &lt;&gt;
#!/usr/bin/env bash&lt;br&gt;
&lt;br&gt;
# examples:&lt;br&gt;
# dropoff&lt;br&gt;
# ~/.pickup/* -&amp;gt; .&lt;br&gt;
&lt;br&gt;
# dropoff server&lt;br&gt;
# server:~/.pickup/* -&amp;gt; .&lt;br&gt;
&lt;br&gt;
# dropoff server target&lt;br&gt;
# server:~/.pickup/* -&amp;gt; target&lt;br&gt;
&lt;br&gt;
_PICKUPDIR=&quot;~/.pickup&quot;&lt;br&gt;
&lt;br&gt;
if [ $1 ]; then&lt;br&gt;
&amp;nbsp;&amp;nbsp;scp -r &quot;${1}:${_PICKUPDIR}/*&quot; &quot;${2:-.}&quot;&lt;br&gt;
else&lt;br&gt;
&amp;nbsp;&amp;nbsp;cp --dereference -prv &quot;${_PICKUPDIR}/*&quot; .&lt;br&gt;
fi&lt;br&gt;
EOF&lt;br&gt;
&lt;br&gt;
cat &amp;gt; pickup &lt;&gt;
#!/usr/bin/env bash&lt;br&gt;
&lt;br&gt;
_PICKUPDIR=&quot;~/.pickup&quot;&lt;br&gt;
&lt;br&gt;
rm -r ${_PICKUPDIR}&lt;br&gt;
mkdir -p ${_PICKUPDIR}&lt;br&gt;
for FILENAME in &quot;$@&quot;; do&lt;br&gt;
&amp;nbsp;&amp;nbsp;ln -sfv &quot;${PWD}/${FILENAME}&quot; ${_PICKUPDIR}&lt;br&gt;
done&lt;br&gt;
EOF&lt;br&gt;
&lt;br&gt;
cat &amp;gt; dropoff &lt;&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;&lt;/code&gt;&lt;/blockquote&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360874</guid>
		<pubDate>Mon, 02 Jun 2008 09:06:12 -0800</pubDate>
		<dc:creator>grouse</dc:creator>
	</item><item>
		<title>By: grouse</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360880</link>	
		<description>Crap. MetaFilter ate my code. Download the scripts from here instead:&lt;ul&gt;&lt;li&gt;&lt;kbd&gt;&lt;a href=&quot;http://pastebin.com/f13a34982&quot;&gt;pickup&lt;/a&gt;&lt;/kbd&gt;&lt;li&gt;&lt;kbd&gt;&lt;a href=&quot;http://pastebin.com/f6ea0451b&quot;&gt;dropoff&lt;/a&gt;&lt;/kbd&gt;&lt;br&gt;
&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360880</guid>
		<pubDate>Mon, 02 Jun 2008 09:09:08 -0800</pubDate>
		<dc:creator>grouse</dc:creator>
	</item><item>
		<title>By: odinsdream</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360919</link>	
		<description>I have to do this all the time, as well. Thank you everyone!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360919</guid>
		<pubDate>Mon, 02 Jun 2008 09:39:17 -0800</pubDate>
		<dc:creator>odinsdream</dc:creator>
	</item><item>
		<title>By: cgg</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360926</link>	
		<description>I&apos;m probably doing this the completely wrong way and am somehow enraging sysadmins everywhere, but what I typically do is mount, via sshfs, the remote machine to the local machine. From there, navigating (and hence copying) the remote machine is trival while on the local machine.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/&quot;&gt;How to mount a remote ssh filesystem using sshfs.&lt;/a&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360926</guid>
		<pubDate>Mon, 02 Jun 2008 09:43:38 -0800</pubDate>
		<dc:creator>cgg</dc:creator>
	</item><item>
		<title>By: fantabulous timewaster</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1360967</link>	
		<description>I have &lt;blockquote&gt;&lt;pre&gt;# Let myself connect back in:&lt;br&gt;
RemoteForward 2217 localhost:22&lt;/pre&gt;&lt;/blockquote&gt; in my laptop&apos;s .ssh/config, and &lt;blockquote&gt;&lt;pre&gt;Host mylaptop&lt;br&gt;
User ft&lt;br&gt;
HostName localhost&lt;br&gt;
Port 2217&lt;/pre&gt;&lt;/blockquote&gt; in the .ssh/config of machines I use regularly. This lets me just &lt;tt&gt;rsync file mylaptop:&lt;/tt&gt; on the remote machine.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1360967</guid>
		<pubDate>Mon, 02 Jun 2008 10:24:06 -0800</pubDate>
		<dc:creator>fantabulous timewaster</dc:creator>
	</item><item>
		<title>By: jepler</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1361128</link>	
		<description>ssh has a &quot;proxy command&quot; which can be used to let you &apos;ssh inner&apos; (and sftp inner, and lftp fish://inner) even if &apos;inner&apos; can only be connected by going through &apos;outer&apos;.  &apos;&lt;a href=&quot;http://netcat.sourceforge.net/&quot;&gt;nc&lt;/a&gt;&apos; (aka netcat) is a Free, small and widely available program which simply creates a tcp connection to the given host and port.  Here&apos;s a &lt;tt&gt;~/.ssh/config&lt;/tt&gt; entry showing how to use nc in this way:&lt;br&gt;
&lt;blockquote&gt;&lt;tt&gt;host inner&lt;br&gt;ProxyCommand ssh outer nc inner %p &lt;br&gt;Protocol 2&lt;br&gt;ForwardAgent yes&lt;/tt&gt;&lt;/blockquote&gt;I quite simply can&apos;t do without this functionality; I must use it a hundred times a day.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1361128</guid>
		<pubDate>Mon, 02 Jun 2008 12:05:18 -0800</pubDate>
		<dc:creator>jepler</dc:creator>
	</item><item>
		<title>By: fantabulous timewaster</title>
		<link>http://ask.metafilter.com/92964/Is-there-a-quick-way-of-copying-files-up-an-SSH-connection#1362705</link>	
		<description>jepler, you&apos;ve helped me to finally understand the proxycommand syntax.  Thanks!  I have several machines that I access through one tunnel, and now that I&apos;ve added &lt;blockquote&gt;&lt;tt&gt;Host outer&lt;br&gt;
LocalForward 2244 inner1:22&lt;br&gt;
LocalForward 2245 inner2:22 &lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
Host inner1&lt;br&gt;
HostName localhost&lt;br&gt;
Port 2244&lt;br&gt;
ProxyCommand /bin/bash -c &apos; echo | nc -w1 %h %p &amp;gt;&amp;amp; /dev/null || ssh outer -f exit &amp;amp;&amp;amp; nc -w1 %h %p &apos;&lt;/tt&gt;&lt;/blockquote&gt;to my &lt;tt&gt;.ssh/config&lt;/tt&gt; I no longer have to futz about with checking whether the tunnel is open already or not.  Thanks!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92964-1362705</guid>
		<pubDate>Tue, 03 Jun 2008 11:26:16 -0800</pubDate>
		<dc:creator>fantabulous timewaster</dc:creator>
	</item>
	</channel>
</rss>
