Command Line SFTP Examples

Command-Line SFTP Examples

Many operating systems come with a built in sftp command that can be used to connect and perform operations via SFTP.

To connect and authenticate

To connect to ExaVault, specify your username and the fully qualified domain name (FQDN) of your ExaVaultsite, separated by an @ character:

sftp username@MYCOMPANY.com

When prompted, enter your password.

To connect and authenticate using a SSH/SFTP Key

Save the SSH/SFTP Key to a file on your computer. For example, my_ssh_key.key

Make sure that the key file has restricted access permissions, so that only your user ID can access the file. Remove the access permissions for Groups and Everyone, leaving only read permission for yourself.

Connect to ExaVault specifying the Key file by using the -i (identity file) flag.

For Mac/Linux:

sftp -i /path/to/my_ssh_key.key username@MYCOMPANY.com

For Windows:

sftp -i C:\path\to\my_ssh_key.key username@MYCOMPANY.com

To upload files

Upload a single file using the put command:

put file.ext

Upload multiple files using the mput (multiple put) command:

mput file1.ext file2.ext file3.ext

Or you can use a wildcard to match and upload multiple file names:

mput file*.ext

To upload a folder

Create the destination folder using the mkdir (make directory) command and make sure the folder name matches the name of the folder you’re trying to upload:

mkdir TheFolderName

Then upload the folder contents using the put -r (put recursively) command:

put -r TheFolderName/

To download files

Download a single file using the get command:

get file.ext

Download multiple files using the mget (multiple get) command:

mget file1.ext file2.ext file3.ext

Or you can use a wildcard to match and download multiple file names:

mget file*.ext

To download a folder

Create the local destination folder using the lmkdir (locally make directory) command and make sure the folder name matches the name of the folder you’re trying to download:

lmkdir TheFolderName

Set your local permissions using the lumask (locally set the mask for user permissions) command:

lumask 002

Download the folder contents using the get -r (get recursively) command:

get -r TheFolderName/

Using the lumask command to set the UMASK to 002 will set the correct permissions for all the files to download successfully. If you miss this step then you might see permission errors, where subfolders will be created but the files contained within them will fail to download.

Last updated

©2023 Orange Platform LLC dba ExaVault. All rights reserved.