Transferring Files On Mac and Linux

  1. Install OpenSSH before logging in to the Supercomputer Systems. OpenSSH is pre-installed in recent distributions.
  2. Generate a public/private key pair by following Generating Key Pair and Registering Public Key, and register the public key via the User Portal.

This section explains how to log in to the Supercomputer Systems using the scp command and the sftp command. Select the host name corresponding to the System type you want to log in.

System Host Name (FQDN) Notes
A (Camphor2) camphor.kudpc.kyoto-u.ac.jp Two login nodes help distribute the load. This is available to system A users only.
B (Laurel2) laurel.kudpc.kyoto-u.ac.jp Three login nodes help distribute the load.
B (with SAS) sas.kudpc.kyoto-u.ac.jp
C (Cinnamon2) cinnamon.kudpc.kyoto-u.ac.jp You can login to the same login nodes as the system B with automatically loaded the environment for the system C.

The scp command works in a similar way to the cp command, the source and destination parameters are specified in the command line argument. The scp command can specify a file name of a remote machine as the source and destination parameters, but the cp command cannot. Modifying a file on a remote machine requires an authentication.

A remote machine’s file is written in the following form: host name of a remote machine:file name. For example, a file(test.txt) in the home directory of the System B can be written as below.

laurel.kudpc.kyoto-u.ac.jp:test.txt

When the user IDs are different between a local machine and a remote machine, put the user ID before a host name, and concatenate them using “at” sign (@). For example, user ID “b59999” can be written as below.

b59999@laurel.kudpc.kyoto-u.ac.jp:test.txt

scp [option] [[userID@]host1:] file1 [[userID@]host2:] file2

Options Purposes
-r Copying a directory including its tree structure when specifying a directory as a copy source.
-p Keeping the time of last modification, the time of last access, and permissions settings of a copy source file.
-C Compressing network traffic.
-i FILENAME Specifying a private key for logging in.

In the following examples, a remote machine will be the System B, and a user ID will be “b59999.”

  • Making a secure copy of “file1.txt” to a remote machine.

    $ scp file1.txt b59999@laurel.kudpc.kyoto-u.ac.jp:
    Enter passphrase for key '/home/test/.ssh/id_rsa':  ←Entering your passphrase.
  • Making a secure copy of “file1.txt” in a remote machine as “file2.txt.”

    $ scp b59999@laurel.kudpc.kyoto-u.ac.jp:file1.txt file2.txt
    Enter passphrase for key '/home/test/.ssh/id_rsa':  ←Entering your passphrase.
  • Making a secure copy of a directory “dir1” to a remote machine.

    $ scp -r dir1 b59999@laurel.kudpc.kyoto-u.ac.jp:
    Enter passphrase for key '/home/test/.ssh/id_rsa':  ←Entering your passphrase.
  • Specifying a private key, and making a secure copy of “file1.txt” to a remote machine.

    $ scp -i ~/.ssh/id_rsa_kyoto file1.txt b59999@laurel.kudpc.kyoto-u.ac.jp:
    Enter passphrase for key '/home/test/.ssh/id_rsa_kyoto':  ←Entering your passphrase.
  • Reading the manual.

    $ man scp

The sftp command is an interactive file transfer program similar to the ftp command. After logging in to the specified remote machine, the interactive command mode is started up.

Commands that can be used in the interactive command mode is similar to ftp. The sftp command does not support mget and mput which deal with directories recursively, so that scp would be more useful than sftp for transferring multiple files.

sftp [option] [[userID@]host[:file [file]]]

Options Purposes
-C Compressing network traffic.
-oIdentityFile=FILENAME Specifying a private key for logging in.

In the following examples, a remote machine will be the System B, and a user ID will be “b59999.”

  • Logging in to a remote machine with SFTP, and Transferring files.

    $ sftp b59999@laurel.kudpc.kyoto-u.ac.jp
    Connecting to laurel.kudpc.kyoto-u.ac.jp...
    Enter passphrase for key '/home/test/.ssh/id_rsa':  ←Entering your passphrase.
    sftp> get file1.txt ←Getting "file1.txt" in a remote machine.
    Fetching /home/a/b59999/file1.txt to file1.txt
    /home/a/b59999/file1.txt                            100% 5615     5.5KB/s   00:00 
    sftp> put file2.txt ←Putting "file2.txt" in a local machine.
    Uploading index.html to /usr/home/test/file2.txt
    file2.txt                                           100% 5615     5.5KB/s   00:00 
    sftp> quit ←Quitting a session.
    $
  • Specifying a private key, and logging in.

    $ sftp  -oIdentityFile=~/.ssh/id_rsa_kyoto   b59999@laurel.kudpc.kyoto-u.ac.jp
  • Reading the manual.

    $ man sftp


Copyright © Academic Center for Computing and Media Studies, Kyoto University, All Rights Reserved.