# File Transfer Tutorial

This tutorial discusses various ways to get data from and to a local (external) machine into and out of SDF.

### Contents

1. Introduction
2. FTP - File Transfer Protocol
3. scp and sftp - secure copying and ftp
4. ssh and tar - securely copying directories
5. Gopher and HTTP - using the internet for download
6. Terminal - direct copying via the terminal
7. E-mail - for small files only
8. Glossary - explications of terms

### To Do

- x/y/zmodem transfers
- kermit transfers

## Introduction

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 FAQ, MEMBER section for more information), the external system, and their connection.

## FTP - File Transfer Protocol

FTP (File Transfer Protocol) on SDF is available only for downloading public files. This is for security reasons. For upload and download of private files, scp and sftp must be used.
Note: ARPA membership allows for up-&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.

For download, point your FTP program to sdf.org and do anonymous FTP to read data (username `anonymous`, password `yourlogin@sdf.org`, or another of your e-mail addresses).

## scp and sftp - secure copying and ftp

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.

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:

`scp *.jpg me@sdf.org :/your/remote/home/`

Let's break that down

scp
  The command itself.
*.jpg
  The files you want to transfer.
me@sdf.org
  Your username @ the server you wish to connect to.
:/your/remote/home/
  The directory you'd like to upload it.

Unless you've installed ssh authorization keys, you'll be prompted for your username and password. Afterwhich, you should have output similar to this:

    [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]#

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.

On Windows machines, you can use the PuTTY programs.

## ssh and tar - securely copying directories

The tar archiving tool can be used with ssh to quickly duplicate whole directory trees:

`tar cf - target_dir | ssh me@freeshell.org " tar xf - -C ~/path/ "`

Note: this trick requires compatible versions of tar on the local and remote systems

## Gopher and HTTP - using the internet for download

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 FAQ, GOPHER section and the website tutorial for information how to set up these sites.

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!

To prevent access by everybody, see the FAQ entry about password protection of websites.

## Terminal - direct copying via the terminal

For transferring small amount of text data (scripts, tables, source code snippets), think about copy/paste directly in the terminal! If you are MetaARPA, then you can use `screen` and its built-in copy facility to transfer data between different screens.

To append text input in the terminal to a file on SDF, you can open the file on SDF in your favourite text editor. Or simply use the command `cat >>file`, 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 `cat` was reading from.

## E-mail - for small files only

If you have to transfer binary data and cannot use scp (because you're not ARPA, 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 (yourlogin@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 `mv`).

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!

## Glossary

ARPA and MetaARPA
  These are additional membership levels on SDF which allow for more commands and provide more space and the good feeling of supporting SDF!
download
  to get data from SDF to your local machine; imagine SDF sitting somewhere uphill so that everybody can see it - then you get the data down from SDF
PuTTY
  This is a software suite for Windows machines for ssh and scp connections.
SDF
  Super Dimensional Fortress - if you don't know what that is, then why are you reading this..? wink
terminal
  The equipment used to connect to a computer in text mode (for a more accurate definition see the corresponding Wikipedia entry), 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.
upload
  to get data to SDF from your local machine; see download

$Id: filetransfer.html,v 1.17 2020/01/01 22:27:19 niro Exp $