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 ExaVault site, separated by an @ character:
sftp [email protected]
When prompted, enter your password.
To Connect and Authenticate Using an SSH/SFTP Key
Save the SSH/SFTP Key to a file on your computer. For example, my_ssh_key.key.
Restrict access permissions on the key file so that only your user ID can access it. Remove access permissions for Groups and Everyone, leaving only read permission for yourself.
Connect to ExaVault and specify the Key file with the -i (identity file) flag.
For Mac/Linux:
sftp -i /path/to/my_ssh_key.key [email protected]
For Windows:
sftp -i C:\path\to\my_ssh_key.key [email protected]
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 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, with a folder name that matches the name of the folder you're uploading:
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 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, with a folder name that matches the name of the folder you're downloading:
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/
Setting the UMASK to 002 with lumask gives the downloaded files the correct permissions. Without this step, subfolders may be created while the files inside them fail to download due to permission errors.
Last updated