Skip to content
NAISS Logo
Allocations Support Training Software naiss.se

tags: - file transfer - sftp - Arrhenius


File transfer to/from Arrhenius using sftp

There are multiple ways to transfer data to/from Arrhenius.

Here, we show how to transfer files and folders using a command-line tool called sftp, which is a secure file transfer tool that works under Linux, Mac and Windows.

Introduction

SFTP is an abbreviation of 'SSH File Transfer Protocol' and 'SSH' is an abbreviation of 'Secure Shell protocol'.

  • The difference from rsync and scp is that you login to a SFTP session
    • just like a log in to a server with SSH.
  • You use the terminal to transfer the files.
  • You need the credentials only when establishing the connection.

Pros

  • Secure
  • Use cases:
    • copying large or many files
    • asks if you want to overwrite target files
    • possible to resume file transfer after a broken connection.
    • handle bulk file transfers
    • modify directories
    • and encrypt or decrypt specific files
When not to use
  • Rsync is better for "syncing"

Procedure

  • Run the sftp commands on YOUR computer, since you probably do not have a server address to your computer!
  • In the terminal (from local, not server session)
sftp <username>@login.hpc.arrhenius.naiss.se

In sftp session, go to right folders and upload/download files to/from the server. You can do this as long as the connection is active!

  • pwd/cd/ls - browse and list files in server file system
  • lpwd/lcd/lls - browse and list files in local file system
  • put <file/folder> - Copy a file/folder from the local computer to the remote host
  • get <file/folder> - Copy a file/folder from the remote host to the local computer
Cheat sheet in the SFTP session
  • ?/help - List of all commands or explain a command, e.g. ? get

Remote

  • put - Copy a file from the local computer to the remote host
  • cd - Change the active directory path on the remote host
  • dir/ls - List the contents of the current directory on the remote host
  • pwd - Show the present working directory path on the remote host
  • mkdir - Create a directory on the remote host
  • rename - Rename a file on the remote host
  • rm - Delete a file on the remote host
  • rmdir - Remove an empty directory on the remote host
  • exit/quit - Close the connection and leave SFTP

Locally

  • get - Copy a file from the remote host to the local computer
  • lcd - Change the active directory on the local system
  • lls - List the contents of the current directory on the local computer
  • lmkdir - Create a directory on the local computer
  • lpwd - Show the present working directory on the local computer

Options for compressing during the transfer

  • Start the sftp session with sftp -C <username>@<hostname>
  • The file(-s) are then also decompressed on the destination.
Example for Arrhenius

Connect to SFTP session

In the terminal, run sftp to connect to Arrhenius by doing:

sftp nisse@login.hpc.arrhenius.naiss.se

If asked, give your center's password. You can get rid of this prompt if you have setup SSH keys

Upload/download files to/from Arrhenius

In sftp session, upload/download files/folders to/from the server.

  • put localfile.txt - Copy a file from the local computer to the remote host
  • get serverfile.txt - Copy a file from the remote host to the local computer