Data storage services > Transfer of files
Tehdyt toimenpiteet

Transfer of files

Files can be transferred from one machine to another with commands scp (secure copy), ftp (File Transfer Protocol) and wget. In addition, files can also be transferred via email.

SCP

The command scp works the same way as the Unix command cp. The difference, however, is that all data passing through the network is encrypted at the sending end and the encryption is decoded at the receiving end. The command scp secures also the session opening phase, i.e. the user ID and password. This command is recommended always when you have to give your user ID and password to the network, in other words, when you transfer files from outside of CSC to CSC servers and vice versa. Below is a transfer, originally made with rcp, by using scp:

Server1> scp 'Server2.csc.fi:$TMPDIR/test' $WRKDIR

The inverted commas are necessary due to the use of the environment variable. If the user ID is not the same in both machines, it has to be given in conjunction with the machine name:

ID@machine name:file path/file


FTP

The FTP file transfer protocol is initiated by the command ftp address of target machine.

The program asks for the password in the target machine. The password is checked, and a session is started at the user’s home directory in the target machine. The FTP command allows the user to browse through the target machine’s directories (command cd) and to move files in both directions (commands put and get).

FTP is not necessary for transfers within CSC. The transfer can be made through the shared metawork directory or by using the rcp command from local directories.

In conjunction with opening an FTP session, the user ID and password are passed to the network in clear-text format. Hence, using FTP should be avoided for transfers over unsecured network connections.

Read more about FTP. A summary of commands and some examples.



Wget

Wget is a handy command for searching files from the World Wide Web or FTP servers. With the command a parameter is placed upon either an address of one file, or an address referring to a certain group of files (*.tar, for example) when contacting FTP servers.

In the following example a file is fetched with wget from computer P2 to computer P1. In this case, computer P2 must accept www-accesses:

P1> wget http://p2.example.com/data/data.tar

In the following example, every file ending with ‘.tar’ from the directory ‘data’ is searched from the FTP server P3 by user ID ‘uname’ and password ‘pword’:
P1> wget ftp://uname:pword@p3.example.com/data/*.tar

What is to be noted is that during the opening of the FTP session the given user ID and password are forwarded to the net in plain text. Thus using the FTP with personal user ID should be avoided.