1. SCP: secure copy - Mac/Linux
  2. PSCP: secure copy - Windows
  3. SFTP: secure file transfer protocol - Mac/Linux
  4. Navigating the directory structure on the local machine
  5. PSFTP: secure file transfer protocol - Windows

Example commands shown are for a hypothetical user: Jane Smith is given the eRSA username “jsmith” and is allocated data storage in a directory with the approved shortname “smithlab”.


1. SCP: secure copy

Mac OSX and Linux

SCP is a simple method for transferring files between computers. It will copy files between two computers with a single text command, and the files will be encrypted during transfer for security.

The basic command for Secure Copy is like the UNIX  cp , but adding a connection to a different computer in the file path.

 scp <Path_To_Source_File> <Path_to_Destination> 

The generic command to access a remote server is  username@hostname:/directory/file.ext .

For eRSA data allocations, this will generally start with  username@rsync.ersa.edu.au:/data/shortname/  with your eRSA username and the shortname for your data allocation directory.

Open your local computer’s “Terminal” application. This is where you enter UNIX text commands.

e.g. Jane Smith can upload a file (data.ext) from her Desktop directory to a directory in the remote storage allocation:

 scp Desktop/data.ext jsmith@rsync.ersa.edu.au:/data/smithlab/JaneSmith/data.ext 

e.g. To download a file from the remote storage to her computer’s Desktop directory:

 scp jsmith@rsync.ersa.edu.au:/data/smithlab/JaneSmith/data.ext Desktop/data.ext 

After entering these scp commands, you will be prompted to enter your eRSA password before the data transfer proceeds.

TIP: You can also use SCP to copy files between two different remote servers. Just use the information for the remote servers (username@hostname:/directory/file.ext) for both the source and destination file. e.g. to transfer from a remote data source to your eRSA storage:


 scp user@remoteserver:/Directory/data.ext jsmith@rsync.ersa.edu.au:/data/smithlab 


2.PSCP - the PuTTY secure copy client for Windows users

Windows users can also securely copy files using text commands, but a compatible SSH client must be installed.

On the PuTTY download page, download the “Windows MSI installer” e.g.  putty-0.67-installer.msi 

Run the installer and accept any default options.

PSCP is used on the windows command line. In the start menu, search for the program “Command Prompt” or “command.exe”. This will open a console window. Type  pscp  then press enter to check the PuTTY programs installed correctly (there should be information about pscp, rather than an error message).

PSCP uses the same generic command style as SCP:

 pscp <Path_To_Source_File> <Path_to_Destination> 

e.g. For Jane Smith to upload a file from her Documents folder to the eRSA remote storage:

 pscp C:\Users\janesmith\Documents\data.ext jsmith@rsync.ersa.edu.au:/data/smithlab/JaneSmith/ 

e.g. For Jane Smith to download a file from the eRSA data storage to her Windows computer:

 pscp jsmith@rsync.ersa.edu.au:/data/smithlab/JaneSmith/data.ext C:\Users\janesmith\Documents\data.ext 

NB - When entering a path to a file on a UNIX-based computer (a Mac/Linux computer or an eRSA server) use a forward slash “ / “ after each directory in the path. When entering a path to a file on a Windows computer, use a back slash instead “ \“.

TIP : To find the path to a file or folder on your computer, find it in your file explorer window, and drag it into your command prompt window. The full path will appear as text at the command prompt.

On the PuTTY website there is a more complete userguide for pscp.


3. SFTP via the Command Line

There are many graphical tools that use SFTP (Secure File Transfer Protocol) such as FileZilla, WinSCP and Cyberduck, but it can also be used in the commandline. Use  sftp  on your MacOSX/Linux computer’s Terminal application, or use PuTTY’s  psftp  in the Windows Command prompt.

SFTP for MacOSX/Linux

Using the sftp command in the Terminal application on your MacOSX/Linux computer allows you to access the files on the remote data server, and upload or download data.

The sftp command opens a connection with the remote server, that will continue until you exit it. While in the SFTP session, you can use commands to manage data on both the remote server and the local computer.

 sftp jsmith@sftp.ersa.edu.au 

You will be prompted to enter your eRSA password.

To move to your data allocation, you will need to ‘change directory’ with the command cd.

 cd /data/smithlab 

Navigating the directory structure on the remote (server) machine

You can use basic linux commands to navigate around the directory structure on the remote server (i.e.  sftp.ersa.edu.au ). For example:

  •  pwd  - print the current working directory
  •  ls  - list the contents of the current directory
  •  ls dir1  - list the contents of directory ‘dir1’
  •  rm blah  - remove the file ‘blah’
  •  rmdir somedir  - remove the directory ‘somedir’
  •  mkdir newdirectory  - create a directory called ‘newdirectory’
  •  cd newdirectory  - change directories to the directory ‘newdirectory’
  •  rename file1 datafile  - rename the file ‘file1’ to be called ‘datafile’
  •  rename file1 newdirectory/file1  - move the file ‘file1’ from the current working directory to the directory ‘newdirectory’.

4. Navigating the directory structure on the local machine

You can use similar commands, normally prefixed with an ‘l’ (for “local”), to navigate around the local directory structure (i.e. the directory structure of the host where you began your  sftp  session).

It is often more convenient to change to the local directory where you want to transfer files to or from, before starting an  sftp  session. For example:

  •  lpwd  - print the current working directory
  •  lls  - list the current directory
  •  lls dir1  - list the contents of dir1
  •  lmkdir newdirectory  - create a directory called  newdirectory 
  •  lcd newdirectory  - change directories to the directory  newdirectory 

To transfer files between the local and remote machine, you can use the following commands:

Upload with  put 
  •  put file1  - copies the file ‘file1’ from the local machine to remote machine
Download with  get 
  •  get file2  - copies the file ‘file2’ from the remote machine to the local machine

End the SFTP session with the commands  exit  or  bye .



5. PSFTP for Windows

Windows users can also use SFTP at the commandline, but a compatible SSH client must be installed.

On the PuTTY download page, download the “Windows MSI installer” e.g.  putty-0.67-installer.msi 

Run the installer and accept any default options.

PSFTP is used on the windows command line. In the start menu, search for the program “Command Prompt” or “command.exe”. This will open a console window.

PSFTP uses the same generic command style as SFTP:

 psftp jsmith@sftp.ersa.edu.au 

You will be prompted to enter your eRSA password.

To move to your data allocation, you will need to ‘change directory’ with the command  cd .

 cd /data/smithlab 

See the section on SFTP for more commands and information, or visit PuTTYs PSFTP userguide.



Did you find this information useful? Share your feedback here.