tutes-dump/site-tutorials/filetransfer.html

167 lines
7.4 KiB
HTML

<h1>File Transfer Tutorial</h1>
<p>This tutorial discusses various ways to get data from and to a local
(external) machine into and out of SDF.</p>
<h3>Contents</h3>
<ol>
<li><a href="#intro">Introduction</a></li>
<li><a href="#ftp">FTP</a> - File Transfer Protocol</li>
<li><a href="#scp">scp and sftp</a> - secure copying and ftp</li>
<li><a href="#ssh">ssh and tar</a> - securely copying directories</li>
<li><a href="#pub">Gopher and HTTP</a> - using the internet for download</li>
<li><a href="#term">Terminal</a> - direct copying via the terminal</li>
<li><a href="#email">E-mail</a> - for small files only</li>
<li><a href="#gloss">Glossary</a> - explications of terms</li>
</ol>
<hr />
<h3>To Do</h3>
<ul>
<li>x/y/zmodem transfers</li>
<li>kermit transfers</li>
</ul>
<hr />
<h2><a id="intro" />Introduction</h2>
<p>To transport data between SDF and your local (or any other external)
machine, there are various ways. Their availability depends on your member
level on SDF (see the
<a href="http://sdf.org/index.cgi?faq?MEMBERS">FAQ, MEMBER section</a>
for more information), the external system, and their connection.
</p>
<h2><a id="ftp" />FTP - File Transfer Protocol</h2>
<p><a href="http://en.wikipedia.org/wiki/File_Transfer_Protocol">FTP
(File Transfer Protocol)</a> on SDF is available only for
<b>downloading</b> public files. This is for security reasons. For
upload and download of private files, <a href="#scp">scp and sftp</a>
must be used.
<br />
<small>Note: ARPA membership allows for up-&amp;download via FTP; however,
it is better to use scp or sftp if possible, as FTP is unencrypted, and
your passwords also have to travel in the clear.</small></p>
<p>For download, point your FTP program to sdf.org and do
anonymous FTP to read data (username <tt>anonymous</tt>, password
<tt><i>yourlogin</i>@sdf.org</tt>, or another of your e-mail
addresses).</p>
<h2><a id="scp">scp and sftp</a> - secure copying and ftp</h2>
<p>scp and sftp are secure ways to transfer data between computers,
based on ssh (secure shell). If you've only worked with ftp before,
you'll be surprised at the ease and benefits to using scp.</p>
<p>Let's say you're logged into sdf and you want to transfer some
pictures from your home machine (named foo in this example) to your sdf
home directory. You would want to use the following command:</p>
<code>scp *.jpg me@sdf.org :/your/remote/home/</code>
<p>Let's break that down</p>
<dl>
<dt>scp</dt>
<dd>The command itself.</dd>
<dt>*.jpg</dt>
<dd>The files you want to transfer.</dd>
<dt>me@sdf.org</dt>
<dd>Your username @ the server you wish to connect to.</dd>
<dt>:/your/remote/home/</dt>
<dd>The directory you'd like to upload it.</dd>
</dl>
<p>Unless you've installed ssh authorization keys, you'll be prompted
for your username and password. Afterwhich, you should have output
similar to this:</p>
<pre>[me@local Pictures]# scp *.jpg me@sdf.org:~/your/remote/home
IMG_016.jpg 100% 1802KB 45.7KB/s 00:39
IMG_017.jpg 100% 1253KB 46.1KB/s 00:40
IMG_018.jpg 100% 1243KB 48.6KB/s 00:25
IMG_020.jpg 100% 1131KB 45.9KB/s 00:39
[foo@local Pictures]#
</pre>
<p>On SDF, you need to have ARPA membership to be able to use them. Check
the manpages of scp and ssh for more information and options to use.</p>
<p>On Windows machines, you can use the <a href="#putty">PuTTY programs</a>.</p>
<h2><a id="ssh">ssh and tar</a> - securely copying directories</h2>
<p>The tar archiving tool can be used with ssh to quickly duplicate whole
directory trees:</p>
<p><code>tar cf - <em>target_dir</em> | ssh me@freeshell.org " tar xf - -C ~/<em>path</em>/ "</code></p>
<p>Note: this trick requires compatible versions of tar on the local and remote systems</P>
<h2><a id="pub" />Gopher and HTTP - using the internet for download</h2>
<p>To get data out of SDF on a local machine, you can of course publish them
on your gopher- or web-site. Please check the
<a href="http://sdf.org/index.cgi?faq?GOPHER">FAQ, GOPHER section</a>
and the
<a href="http://sdf.org/index.cgi?tutorials/building_a_website">
website tutorial</a>
for information how to set up these sites.</p>
<p>Please note that HTTP traffic is bandwidth limited depending on your
membership level; if you go over the quota, your site will be temporarily
blocked!</p>
<p>To prevent access by everybody, see the FAQ entry about
<a href="http://sdf.org/index.cgi?faq?WEB?04">password protection</a>
of websites.</p>
<h2><a id="term" />Terminal - direct copying via the terminal</h2>
<p>For transferring small amount of text data (scripts, tables,
source code snippets), think about copy/paste directly in the
terminal! If you are
<a href="http://sdf.org/index.cgi?faq?MEMBERS?01">MetaARPA</a>,
then you can use <tt>screen</tt> and its built-in copy facility to
transfer data between different screens.</p>
<p>To append text input in the terminal to a file on SDF, you can open the
file on SDF in your favourite
<a href="http://sdf.org/index.cgi?faq?BASICS?09">text editor</a>.
Or simply use the command <tt>cat &gt;&gt;<i>file</i></tt>, send
the data to the terminal (via the paste function), and finish with
a single line containing only ^D (CTRL-D) - to do that in the
terminal, hit RETURN, CTRL-D, RETURN; this will close the standard
input the <tt>cat</tt> was reading from.</p>
<h2><a id="email" />E-mail - for small files only</h2>
<p>If you have to transfer binary data and cannot use scp (because you're not
<a href="http://sdf.org/index.cgi?faq?MEMBERS?01">ARPA</a>,
which is a pity), then you may need to use file transfer via e-mail. For
this, you attach the data you want to get into SDF to a message which you
send to your address on SDF (<i>yourlogin</i>@sdf.org). On SDF, you
read the message and save the attachment where you need the data (e.g, in
your home directory, from where you can move them using <tt>mv</tt>).</p>
<p>This may not work for large attachments, as the e-mail system
(everywhere!) was not intended for file transfer. If you have to
regularly transfer large files, you should seriously consider
becoming ARPA!</p>
<h2><a id="gloss" />Glossary</h2>
<dl>
<dt>ARPA and MetaARPA</dt>
<dd>These are additional
<a href="http://sdf.org/index.cgi?faq?MEMBERS?01">membership</a>
levels on SDF which allow for more commands and provide more space and the
good feeling of supporting <a href="http://sdf.org">SDF</a>!</dd>
<dt>download</dt>
<dd>to get data <em>from SDF</em> to your local machine; imagine
SDF sitting somewhere uphill so that everybody can see it - then
you get the data <em>down</em> from SDF</dd>
<dt><a id="putty" /></a><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty">PuTTY</a></dt>
<dd>This is a software suite for Windows machines for ssh and scp connections.</dd>
<dt><a href="http://sdf.org">SDF</a></dt>
<dd>Super Dimensional Fortress - if you don't know what that is,
then why are you reading this..? <i>wink</i></dd>
<dt>terminal</dt>
<dd>The equipment used to connect to a computer in text mode
(for a more accurate definition see the corresponding
<a href="http://en.wikipedia.org/wiki/Computer_terminal">Wikipedia entry</a>),
or in a narrower context the window which gives access to a SDF in text mode.
If you are using Windows, it may be a telnet window (or better use
PuTTY for secure access via ssh - that's even possible without
being ARPA), or on a Linux machine an xterm window.</dd>
<dt>upload</dt>
<dd>to get data <em>to SDF</em> from your local machine; see
<i>download</i></dd>
</dl>
<hr />
<cite>$Id: filetransfer.html,v 1.17 2020/01/01 22:27:19 niro Exp $</cite>