Using FTP

How to use anonymous FTP to send or receive data. This text is partly a general guide, and partly instructions on how to use geo-ftp.uio.no.

FTP: File Transfer Protocol

FTP is a way to transfer files from one computer to another over the Internet. FTP has been around since the early days of the internet, and is still widely available.

The first rule of FTP, don't use FTP!

All traffic over FTP is non-encrypted, including passwords. The way the protocol works makes it sometimes hard to get it right (hence this document).

There are better ways to retrieve or share data, depending on the circumstances:

The rest of this text will assume you still have to use FTP. Consider yourself warned.

Whose side are you on?  

External user, or client.

If you are outside UiO and wish to send data to — or receive data from — a colleague at Dept. of Geosciences, you will need an FTP client program capable of using PASSIVE mode. Unfortunately, the standard Windows ftp.exe program does not support PASSIVE (according to numerous web reports), so you'll need to find some other ftp client.

(The opposite ACTIVE mode might accidentally work, but do not ask us about it.)

Many Linux distros do not install the ftp client by default. You can probably install it yourself from the standard package repositories.

The Department FTP server is called geo-ftp.uio.no. The following command dialogue is typical for a Linux ftp program, it might be different for you — consult your system documentation. Type only the text in boldface:

First, navigate to the directory containing the file or files you want to send, or where you want to receive files. For example, in the Linux shell:

$ cd my_data/rock_samples

Connect to the ftp server:

$ ftp geo-ftp.uio.no
(...)
220 Welcome to Geo FTP Server at the University of Oslo. For inquiries, contact drift AT geo.uio.no.
Name (geo-ftp.uio.no:hpverne): ftp

You will be prompted for a password. You can type anything here, your email address is suggested, or your full name. (That will make it easier for us to help you if you get stuck, we will not use your name or email for any other purpose).

331 Please specify the password.
Password:your email address here

You will be shown a short welcome text, and prompted for an FTP command:

230-Welcome to Department of Geoscience
230-at University of Oslo FTP service.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

Make sure you are using passive:

ftp> passive
Passive mode off.

Whoops, now we actually turned it off. Never mind, just turn it on again:

ftp> passive
Passive mode on.

If you are going to deposit files, go to the /incoming directory:

ftp> cd /incoming
250-Here you can upload files, but you cannot download them.
250-Please consider creating a sub-directory for multiple files.
250 Directory successfully changed.

If you plan to deposit more than one file, please create a subdirectory, e.g.:

ftp> mkdir RockSamples
257 "/incoming/RockSamples" created
ftp> cd RockSamples
250 Directory successfully changed.

You can now send your file with put:

ftp> put sample1.jpg
local: sample1.jpg remote: sample1.jpg
227 Entering Passive Mode (129,240,118,246,213,31).
150 Ok to send data.
226 Transfer complete.
68665 bytes sent in 0.0333 secs (2062.51 Kbytes/sec)

If you have several files, turn off prompting and use mput:

ftp> prompt
Interactive mode off.
ftp> mput *.jpg
local: sample1.jpg remote: sample1.jpg
227 Entering Passive Mode (129,240,118,246,199,250).
150 Ok to send data.
226 Transfer complete.
217218 bytes sent in 0.215 secs (1008.47 Kbytes/sec)
local: sample2.jpg remote: sample2.jpg
227 Entering Passive Mode (129,240,118,246,213,30).
150 Ok to send data.
(.... etc etc ....)

If you want to retrieve files, go to the /pub directory:

ftp> cd /pub
250-If we have anything to share, it will be in this directory.
250 Directory successfully changed.

The files you seek are most likely in a subdirectory here. Take a look, and descend into the right directory:

ftp> dir
227 Entering Passive Mode (129,240,118,246,208,117).
150 Here comes the directory listing.
drwxr-xr-x    2 239316   173601       2048 Sep 25 13:29 ClimateData
-rw-r--r--    1 0        0              53 Dec 05  2014 en_mystisk_fil
226 Directory send OK.
ftp> cd ClimateData
250 Directory successfully changed.

You can use dir again and get individual files, but let's keep it simple and assume you simply want to grab it all. Turn off prompting (unless you already did so):

ftp> prompt
Interactive mode off.

Use mget to fetch all files:

ftp> mget *
local: file1.data remote: file1.data
227 Entering Passive Mode (129,240,118,246,209,174).
150 Opening BINARY mode data connection for ceed11-diskfeil.jpg (217218 bytes).
226 Transfer complete.
217218 bytes received in 0.0436 secs (4983.09 Kbytes/sec)
local: file2.data remote: file2.data
227 Entering Passive Mode (129,240,118,246,208,8).
150 Opening BINARY mode data connection for ceed16-diskfeil.jpg (209246 bytes).
(.... etc etc ....)

That's it! Log out:

ftp> exit
221 Goodbye.
A Few Things...

You will not be able to retrieve any files you have uploaded. Or that anybody else have uploaded, for that matter. If you want your files to be available to others, they must be moved to the /pub directory by somebody at the Department.

If you leave your FTP session unattended for a few minutes, it will time out. Just connect again.

If you cannot download files in /pub, it might be that your colleague at the Department has forgotten to make them readable. Just send her a friendly reminder.

If you wonder what the fuss with PASSIVE is all about, I suggest this text. (But you should probably know a little bit about how the Internet works).

Department Use

If you have a user account at the department, you can retrieve files from the FTP storage are, or put stuff there for others to fetch.

Please keep in mind, we only provide public and anonymous access. You cannot keep the files from being available to anyone! (But you can encrypt the files first).

For historical reasons, you will need to be a member of the file group georemot to access the FTP storage area. Contact us if you need this.

The storage area is /uio/hypatia/geofag-felles/data/ftp/ , or the Windows equivalent \\hypatia.uio.no\lh-mn-geofag-felles\data\ftp . Here, you will find the pub and incoming directories.

Publishing data

To share data with FTP, put the data in the pub directory. Either as a single file (perhaps a zip archive or similar), or as a subdirectory with several files. Do not create a "deep" directory structure, as it is more difficult to download. Remember to make the file(s) readable.

For example, from the Linux command line:

$ zip mydata.zip *.data
$ cp mydata.zip /uio/hypatia/geofag-felles/data/ftp/pub/
$ chmod a+r /uio/hypatia/geofag-felles/data/ftp/pub/mydata.zip

Or alternately:

$ mkdir /uio/hypatia/geofag-felles/data/ftp/pub/mydata
$ cp *.data /uio/hypatia/geofag-felles/data/ftp/pub/mydata/
$ chmod -R a+rX /uio/hypatia/geofag-felles/data/ftp/pub/mydata/

You should probably consider a more informative name than "mydata", though.

Now, test! Use the procedure outlined in the first part of this guide to download the files with ftp.

Retrieving data

If you plan to receive data by FTP from somebody, they will place it in the incoming directory. Possibly the name of the file or subdirectory will be self-explaining, or you must get a notification from your external parter. Just copy the file to wherever you want them. For instance:

$ mkdir new_data
$ cp /uio/hypatia/geofag-felles/data/ftp/incoming/DATA.zip new_data/

Remember to clean up afterwards:

$ rm /uio/hypatia/geofag-felles/data/ftp/incoming/DATA.zip

A word of caution!

Anyone can place files in the incoming area, and anyone does! There could be files here designed to damage your PC, i.e. a virus, trojan or other malware. They might be disguised as a ZIP file, but actually be executables. Do not copy or click on files here that you do not know the purpose for.


That should cover the most of it. Keep in mind that the FTP storage area is not for long-time storage, and data in the incoming directory will be deleted if older than three months, or if they take up a lot of space.

If you have questions or comments, feel free to contact the IT staff.

Published Sep. 26, 2018 5:24 PM - Last modified Mar. 1, 2023 12:29 PM