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:
|ls||List contents of remote working directory|
|lls||List the contents of the local working directory|
|pwd||Displays the name of the local working directory|
|cd||Changes the remote working directory|
|lcd||Changes the local working directory|
|get||Copies a file from the remote directory to the local directory|
|put||Copies a file form the local directory to the remote directory|
|delete||deletes a file from the remote working directory|
To get a complete list of commands you can type help or ?