<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE artikkel PUBLIC "-//infoweb.ntnu.no//DTD Infoweb 1.0//NO" "http://infoweb.ntnu.no/infoweb.dtd">
<artikkel versjon="1.1" spraak="en">
  <tittel>FTP how-to</tittel>
  <forfatter>livermor</forfatter>
  <sammendrag>
   Basic FTP how-to. Transfer files to and from home directory with FTP. Often encountered problems with FTP. 
  </sammendrag>
  <lenker>
    <infoweb tittel="Windows NT/2000/XP, connecting to your homedir." aid="255"/>
  </lenker>

  <hoveddel>
    <os2>Outdated information</os2>  
      <avsnitt>
         As FTP transmits your password in clear text, this is not in use at NTNU. System Management has decided to use 
         <uthev>sftp</uthev> instead. You can read more about this 
         <dataord tittel='Information on Secure FTP' uri='http://infoweb.ntnu.no/read_article.php?aid=301'>here</dataord>.
      </avsnitt>

    <os2>What is FTP?</os2>
      <avsnitt>
         FTP, File Transfer Protocol, is a protocol used for exchanging files over networks that support 
         <uthev>TCP/IP</uthev>, like the Internet.
      </avsnitt>
      <avsnitt>
         To use FTP you need an <uthev>FTP-client</uthev>. There are various FTP-clients around, and most of today's web browsers 
         have one. In all versions of Windows and most *nix-installations you get a text-based one, 
         although those with graphical interface are more commonly used.  
      </avsnitt>
    
    <os2>Anonymous and non-anonymous FTP and access to your home directory</os2>
      <avsnitt>
         There are two different ways of connecting to an FTP-server; <uthev>anonymous</uthev> and <uthev>non-anonymous</uthev>. 
         In the former option, you log in with username <uthev>anonymous</uthev> and use your e-mail address as password. 
         This is most commonly used when you want to distribute files for the whole world and not just specific persons. 
         For more specific file transfer, like between two friends or giving people permission to access your home directory, 
         you need a username and password. 
      </avsnitt> 
      <avsnitt>
         Logging in to e.g. <uthev>ftp.nvg.ntnu.no</uthev> anonymously will give you access to 
         <dataord tittel="Wikipedia's description of 'mirroring'" uri="http://en.wikipedia.org/wiki/Mirror_site" brutt="nei">mirrors</dataord> 
         with linux-distributions and similar entities, which are free for all.
      </avsnitt>

    <os2>Using text-based clients</os2>
      <avsnitt>
         By writing <kommando>ftp</kommando> in a command window in both Windows and *nix-based environments you will start the FTP-client. 
         Then, to connect a machine you write <kommando>open nameofmachine</kommando>, where "nameofmachine" could be <kursiv>ftp.nvg.ntnu.no</kursiv>. 
         Log in either anonymously or non-anonymously and you will get an answer looking something like this: 
         <konsoll>
            230 User hansjorg logged in.
            Remote system type is UNIX.
            ftp<tegn symbol="#62"/>
         </konsoll>
      </avsnitt>
      
      <avsnitt>
         Here is a short summary of commonly used FTP-commands
      </avsnitt>
      
      <tabell sammendrag="Table of FTP-commands" ramme="1">
        <tr><th>Command</th><th>Description</th></tr>
        <tr><td><kommando>ls</kommando></td><td>List files in the current directory</td></tr>
        <tr><td><kommando>cd directoryname</kommando></td><td>Change directory</td></tr>
        <tr><td><kommando>get file</kommando></td><td>Download file</td></tr>
        <tr><td><kommando>put localfilename</kommando></td><td>Upload file</td></tr>
        <tr><td><kommando>lcd</kommando></td><td>Change local downloadfolder</td></tr>
        <tr><td><kommando>quit</kommando></td><td>Quit FTP</td></tr>
      </tabell>
      
      <avsnitt>
         If you want to transfer other types of files than just text, you have to use the command <kommando>binary</kommando>. If you don't, everything 
         but plain text will be ruined during transfer.
      </avsnitt>
      
      <avsnitt>
         For more commands with supplementary description you can use the commands <kommando>help</kommando> for overall help, and <kommando>help command</kommando> 
         for assistance in relation to a specific command.
      </avsnitt>
      
      <avsnitt>
         An alternative to the usual FTP-client in Unix/Linux/BSD-installations at NTNU is <kursiv>ncftp</kursiv>, which you use in the same way, but start with 
         the command <kommando>ncftp</kommando>. It is equipped with more functions like bookmarks and storage of passwords.
      </avsnitt>

    <os2>FTP in web browsers</os2>
      <avsnitt>
         Most web browser have built-in FTP-client. All you have to do then is to use an address which somehow tells the web browser 
         that you want to use its FTP-client. So if you want to use anonymous login you use the address <uthev>ftp://ftp.nvg.ntnu.no/</uthev> 
         if you want to connect to NVG's FTP-server at NTNU.
      </avsnitt>
      <avsnitt>
         On the other hand, for non-anonymous login you use an address on the form <uthev>ftp://username@ftp.nvg.ntnu.no/</uthev>. 
         Your web browser will then prompt you for your password.
      </avsnitt>

    <os2>Problems with FTP</os2>
      <avsnitt>
         Some FTP-clients have problems with symlinks, and a result of this is that you cannot access your <uthev>public_html</uthev>-directory. 
         To solve this you can change directory to the directory the symlink points to. In a text-based client you do this with 
         <kommando>cd /local/www.stud/users/brukernavn</kommando>. In clients with graphical interfaces you should be able to choose something like 
         <kursiv>Change Dir</kursiv>, where you then can give the path <uthev>/local/www.stud/users/brukernavn</uthev>.
      </avsnitt>
      <avsnitt>
         Another common problem is that the ls command might not work as a result of a firewall. A solution to this is turning on 
         <dataord tittel='Description of "Passive mode"' uri='http://searchnetworking.techtarget.com/sDefinition/0,,sid7_gci512897,00.html'>passive mode</dataord> 
         in the FTP-client.
      </avsnitt>

    <os2>FTP-alternatives</os2>
      <avsnitt>
         The easiest/most commonly used way of accessing your home directory is by 
         <dataord tittel='Windows NT/2000/XP, connecting to your homedir.' uri='http://infoweb.ntnu.no/read_article.php?aid=255'>connecting to it with samba</dataord>, 
         Windows-network. On the other hand, if your machine has neither Windows or Samba, you can use 
         <dataord tittel='SFTP - Secure FTP' uri='http://infoweb.ntnu.no/read_article.php?aid=301'>SFTP</dataord>.
      </avsnitt>
      <avsnitt>
         A third alternative is <kursiv>scp</kursiv> (Secure CoPy). You can find <kursiv>scp</kursiv> on most of NTNU's unix-machines and you can install it at home. 
         To copy a file from a unix-machine to another you use <kommando>scp filename username@othermachine:</kommando>. 
         In contrast to normal <kursiv>ftp</kursiv>, <kursiv>scp</kursiv> uses a secure connection so that the information transferred is protected and cannot easily 
         be picked up. 
      </avsnitt>
  </hoveddel>
</artikkel>
