How to use SCP or SFTP Command Line to download (or upload) a file to sftp.rsa.com
2 months ago
Article Number
000068217
Applies To
Any RSA product, SecurID, IGL etc...
Issue
Sometimes a customer may want a quick command line download, or on other occasions the https://sftp.rsa.com is disabled .For these or other reasons it can be useful to have access to Command line SFTP or SCP file transfer commands.

Customers can use a Command Line SFTP client like WinSCP.com, or one built-in to Linux of Windows (PowerShell - See Notes) to download a file from RSA such as a Hotfix.
Customers can also optionally upload Troubleshooting logs via command line - or  See KB 000068205 How to upload files onto the RSA SFTP server using SFTP Clients for instructions on using GUI based WinSCP.exe uploads.
 
Tasks
1. Download / Install WinSCP or use an existing SCP / SFTP client, e.g. Windows PowerShell scp
2. open connection to sftp.rsa.com using support Password1 credentials
3. cd to directory, incoming for uploads, outgoing for downloads
4. put log.zip file on sftp.rsa.com   or    get <filename> to download a file from RSA e.g. a hotfix or other software or debug tool
Resolution
Download a file from sftp.rsa.com
You can also download a file placed on sftp.rsa.com by support. You need to know the path and file name from RSA to do this!

Use your WinSCP.com file from the DOS CMD prompt, as shown below. By default downloaded files will be in the directory that you started WinSCP.com from, so it might make sense to use your C:\Temp or C:\User directory and enter a path to WinSCP. You should see the prompt

winscp>

SCP_Get_started_full_path
Open a connection to sftp.rsa.com using   support/Password1  as credentials. This examples assumes the file is located on sftp.rsa.com in /Distribution/support/Patches/SecurID/Server/8.6 Early Access

winscp> open sftp.rsa.com
Username: support
Password:                    < Password1 >
winscp> cd Patches
winscp> cd SecurID
winscp> cd Server
winscp> cd "8.6 Early Access"
winscp> get <you need to know the exact file name>

If this file is large, the  download could take a while. You will see a running total / % while it is downloading

<file_name> |     1331259 KB | 1811.8 KB/s | binary |  42%
  SCP_download

When file is 100% transferred, it will be in your WinSCP directory by default, so copy it to a useable directory after this.
<file_name> |     3141025 KB | 1840.8 KB/s | binary | 100%
winscp> close
winscp> exit

The <file_name> in this case ami-0c3ac97c930bb9c8e.bin will be in your WinSCP directory, so copy it to C:\Users\ebarringe

  SCP_download_2

Upload a log file (log.zip) to sftp.rsa.com

You can upload Troubleshooting log files to sftp.rsa.com using an SCP or SFTP client such as WinSCP. Sometimes a Firewall or VPN blocks SFTP access through TCP port 22, so you may need to modify settings to connect.

Use your WinSCP.com file from the DOS CMD prompt, noting the directory this file runs from as it will be the default upload or download directory. 

c:\Users\Jay.Guillette\Downloads\WinSCP-6.1.1-Portable>WinSCP.com
winscp>

SCP_firewall_block

Open a connection to sftp.rsa.com using   support/Password1  as credentials and put your log file up in the incoming directory

winscp> open sftp.rsa.com
Username: support
Password:                    < Password1 >
winscp> cd Incoming
winscp> put logs.zip
logs.zip                  |         268 KB |  399.4 KB/s | binary | 100%

SCP_put_incoming

You can ignore Skip all error messages, as the support account has no read access. Do not worry!

Let Support know the file name after you finish the upload
 
Notes
The WinSCP GUI interface might work for put to upload a file, but you need the CMD line to enter the file name for download.
See KB 000068205 How to upload files onto the RSA SFTP server using SFTP Clients for instructions on using GUI based WinSCP.exe uploads.

Windows Powershell has an SFTP client built-in, but you need to specify the -ohostkeyalgorithms=+ssh-dss  Switch
Note: this example does not prompt for UserID=support, it enters support@sftp.rsa.com as the UserID on the sftp command line.

PS C:\Users\[first].[lastname]> sftp -ohostkeyalgorithms=+ssh-dss support@sftp.rsa.com
support@sftp.rsa.com's password:
Connected to sftp.rsa.com.
sftp> pwd
Remote working directory: /Distribution/support
sftp> cd outgoing
sftp> pwd
Remote working directory: /Distribution/support/outgoing
PowerShell