====== File Transfer Tutorial ====== This tutorial discusses various ways to get data from and to a local (external) machine into and out of SDF. ==== Contents ==== - [[#Introduction]] - [[#FTP - File Transfer Protocol]] - [[#scp and sftp - secure copying and ftp]] - [[#ssh and tar - securely copying directories]] - [[#Gopher and HTTP - using the internet for download]] - [[#Terminal - direct copying via the terminal]] - [[#E-mail - for small files only]] - [[#Zmodem - Using Microsoft Hyper Terminal for File Transfer]] - [[#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 [[http://sdf.lonestar.org/index.cgi?faq?MEMBERS|FAQ, MEMBER section]] for more information), the external system, and their connection. ===== FTP - File Transfer Protocol ===== [[http://en.wikipedia.org/wiki/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 - secure copying and ftp|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.lonestar.org and do anonymous FTP to read data (username "anonymous", password "//yourlogin//@sdf.lonestar.org", or another of your e-mail addresses). ===== scp and sftp - secure copying and ftp ===== [[http://en.wikipedia.org/wiki/Secure_copy|scp]] and [[http://en.wikipedia.org/wiki/Secure_file_transfer_program|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.lonestar.org :/your/remote/home/ Let's break that down //scp//: The command itself.\\ //*.jpg//: The files you want to transfer.\\ //me@sdf.lonestar.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.lonestar.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 [[http://sdf.lonestar.org/index.cgi?faq?GOPHER|FAQ, GOPHER section]] and the [[http://sdf.lonestar.org/index.cgi?tutorials/building_a_website| 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 [[http://sdf.lonestar.org/index.cgi?faq?WEB?04|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 [[http://sdf.lonestar.org/index.cgi?faq?MEMBERS?01|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 [[http://sdf.lonestar.org/index.cgi?faq?BASICS?09|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 [[http://sdf.lonestar.org/index.cgi?faq?MEMBERS?01|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.lonestar.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! ===== Zmodem - Using Microsoft Hyper Terminal for File Transfer ===== Here I will be showing you all how to transfer file to and from a server through the Z-Modem Protocol using the hyper terminal tool. \\ \\ Open up hyper terminal and create a connection to the server on port 23 using TCP/IP(Winsock). {{ tutorials:zmodem1.png?600 }}\\ Log in using your username and password. {{ tutorials:zmodem2.png?600 }}\\ If you want to upload a file to the server then use the "rz" command. This will set your connection on the server side to receive mode. {{ tutorials:zmodem3.png?600 }}\\ Now Send the file using the Z-modem protocol. Remember that since you are using "rz" on the server side you must match the same protocol for sending the f ile. {{ tutorials:zmodem4.png?400 }} {{ tutorials:zmodem5.png?400 }} {{ tutorials:zmodem6.png?400 }} {{ tutorials:zmodem7.png?600 }} If you want to receive file from the server then set the same protocol that you are going to use on the server side for the receive mode. {{ tutorials:zmodem8.png?600 }} {{ tutorials:zmodem9.png?400 }} Now just use the sz command on the server side to send the file.\\ $ sz  filename {{ tutorials:zmodem10.png?600 }} ===== Glossary ===== === ARPA and MetaARPA === These are additional [[http://sdf.lonestar.org/index.cgi?faq?MEMBERS?01|membership]] levels on SDF which allow for more commands and provide more space and the good feeling of supporting [[http://sdf.lonestar.org|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 === [[http://www.chiark.greenend.org.uk/~sgtatham/putty/|PuTTY]] 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 [[http://en.wikipedia.org/wiki/Computer_terminal|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.13 2012/05/29 05:33:25 credmon Exp $