Month: November 2019

Using SFTP to Move Files to or from a Remote Server

I have a couple of AWS instances running for class and regularly need to move files back and forth to the server from my local machine. I was initially using scp for this task, but navigating the file system on the remote machine was onerous and unwieldy. Enter SFTP….

SSH File Transfer Protocol is a secure way to move files between two machines using the SSH protocol to authenticate.

I already had a private key file set up to access my instance via SSH, and the connection command is very similar:

sftp -i name_of_your_keyfile.pem user@your_hostname

The -i parameter indicates that you are using a key file. Replace the generic placeholders with your information.

Once you are connected your prompt will change to sftp>.

Many of the available commands will be familiar, if you are used to navigating a Linux file system via a terminal:

lsList contents of remote working directory
llsList the contents of the local working directory
pwd Displays the name of the local working directory
cd Changes the remote working directory
lcdChanges the local working directory
getCopies a file from the remote directory to the local directory
putCopies a file form the local directory to the remote directory
deletedeletes a file from the remote working directory

To get a complete list of commands you can type help or ?