--- title: 'File transfer with SSH' taxonomy: category: - docs external_links: process: true no_follow: true target: _blank mode: active --- [toc] ## Prerequisite Generate a public/private key pair by following [Generating Key Pair and Registering Public Key](/login/pubkey), and register the public key via [the User Portal](https://web.kudpc.kyoto-u.ac.jp/portal/). ## How to transfer files{#transfer} We provide instructions for connecting using scp and sftp commands. On Windows, you can also connect using [MobaXterm](/login/mobaxterm). MobaXterm allows file transfers via GUI. ### Connection Destination The host names for each system are as follows. | System Name | Host Name | Note | | --- | --- | --- | | File Transfer Server | hpcfs.kudpc.kyoto-u.ac.jp | **recommended**<br>Consists of two servers. Dedicated SFTP and RSYNC servers with no time limits. | | System A | camphor.kudpc.kyoto-u.ac.jp | Consists of two login nodes. | | System B/Cloud | laurel.kudpc.kyoto-u.ac.jp |Consists of three login nodes. | | System C | cinnamon.kudpc.kyoto-u.ac.jp | Consists of three login nodes. | | System G | gardenia.kudpc.kyoto-u.ac.jp | Consists of two login nodes. | <!-- | A | camphor.kudpc.kyoto-u.ac.jp | Consists of two login nodes. | | B | laurel.kudpc.kyoto-u.ac.jp | Consists of three login nodes. | | C | cinnamon.kudpc.kyoto-u.ac.jp | Connect to the laurel login node with the Cinnamon environment loaded. | | G | gardenia.kudpc.kyoto-u.ac.jp | Consists of four login nodes. | --> ### File transfers using the scp command{#scp} ```nohighlight $ scp [options] [source path] [destination path] ``` #### Example The remote machine is system B and the user ID is b59999. * Transfer file1.txt on the local machine to the home directory of the remote machine. ```nohighlight $ scp file1.txt b59999@laurel.kudpc.kyoto-u.ac.jp: Enter passphrase for key 'id_rsa': ``` * Transfer file1.txt of the remote machine to the local machine as file2.txt. ```nohighlight $ scp b59999@laurel.kudpc.kyoto-u.ac.jp:file1.txt file2.txt Enter passphrase for key 'id_rsa': ``` * Transfer the directory dir1 of the local machine to the remote machine. ```nohighlight $ scp -r dir1 b59999@laurel.kudpc.kyoto-u.ac.jp: Enter passphrase for key 'id_rsa': ``` * Transfer file1.txt of the local machine to the remote machine after specifying the private key. ```nohighlight $ scp -i id_rsa file1.txt b59999@laurel.kudpc.kyoto-u.ac.jp: Enter passphrase for key 'id_rsa': ``` ### File transfers using the sftp command{#sftp} ```nohighlight $ sftp [Option] [Connection Destination] ``` #### Example The remote machine is system B and the user ID is b59999. ```nohighlight $ sftp b59999@laurel.kudpc.kyoto-u.ac.jp Enter passphrase for key 'id_rsa': Connected to laurel.kudpc.kyoto-u.ac.jp. sftp> put file1.txt Uploading file1.txt to /home/b/b59999/file1.txt file1.txt 100% 31 9.8KB/s 00:00 sftp> ls file1.txt sftp> get file2.txt Fetching /home/b/b59999/file2.txt to file2.txt /home/b/b59999/file2.txt 100% 31 4.2KB/s 00:00 sftp> quit ```