Background
This is a step-by-step guide for readers to download a file using SCP (Secure Copy Protocol).
Prerequisites
Follow the VPK deployment method: Virtru Private Keystore (for Virtru Solutions) - Standard Linux Server.
Option 1:
Step 1: Log Into the Virtru Private Keystore Server
- Navigate to the cks directory:
cd /var/virtru/cks - Copy and save the token.json file from the VPK server to your computer
cd /var/virtru/cks/token-store
cat token.json- copy the output and save it to your computer as tokens.json
- Navigate to the cks directory:
cd /var/virtru/cks- Copy and save the token.json file from the VPK server to your computer
cd /var/virtru/cks/keys
cat rsa_001.pub- copy the output and save it to your computer as rsa_001.pub
Step 2: Email the Content
- Once you've copied the information from the server and successfully saved it to your computer.
Send the file via Secure Share to the deployment team: Secure Share
Option 2:
Step 1: Open Your Terminal
- For macOS or Linux Users: Open the Terminal application. You can do this by searching for "Terminal" in your applications folder or Launchpad.
- For Windows Users: You'll need to use an SSH client like PuTTY or Windows Subsystem for Linux (WSL). For this guide, we'll assume you're using a terminal in WSL or another SSH client that supports SCP.
Step 2: Locate Your SSH Private Key
Before you proceed, ensure you have the SSH private key ('certificate.pem') ready. This key is required to authenticate your connection to the remote server.
- If you haven't already, move your 'certificate.pem' file to a secure and easily accessible location on your system.
Step 3: Set File Permissions (Optional)
For security reasons, it's essential to ensure that your private key file has the correct permissions set. This step is mainly for macOS and Linux users. Windows users can skip to Step 4.
- In the terminal, navigate to the directory containing your 'certificate.pem' file.
-
Run the following command to set the appropriate permissions:
chmod 600 /Users/username/location_to_certificate/certificate.pem
Replace '/Users/username/location_to_certificate/certificate.pem' with the actual path to your 'certificate.pem' file.
Step 4: Use SCP to Download the File
Now, use the SCP command to download the desired file from the remote server to your local machine.
-
Run the following command in your terminal:
scp -i /Users/username/location_to_certificate/certificate.pem user@cks_host_server:/path_to/send_to_virtru.tar.gz /download_location
- Replace:
'/Users/username/location_to_certificate/certificate.pem' with the actual path to your 'certificate.pem' file. - 'user@cks_host_server' with the actual username and hostname (or IP address) of the remote server.
- '/path_to/send_to_virtru.tar.gz' with the actual path to the 'send_to_virtru.tar.gz' file on the remote server.
- '/download_location' with the path on your local machine where you want to save the downloaded file.
Step 5: Verify the Download
- After the command executes, check your specified download location to ensure the 'send_to_virtru.tar.gz' file is there.
- You can use the 'ls' command (for macOS/Linux) or the 'dir' command (for Windows) in the terminal to list the files in the download location and verify the presence of the downloaded file.
See the image below as a reference:
Option 3:
Downloading a File from Google Cloud VM to Local Computer (Windows)
- Google Cloud SDK is installed and authenticated on your local machine
Install guide - You have SSH access to the GCP VM
- You know the VM Instance name, project, zone, and file path on the VM
For relevant information, log into console.cloud.google.com
The Virtual Machine instance information can be found in GCP > Compute Engine > VM Instances
1. Open Command Prompt
In the Program Files, launch the Command Prompt as your user (e.g., prince.vonleh).
Authenticate
Set Your Project (optional)
2. Run gcloud compute scp
Use the following command format:
gcloud compute scp [USERNAME]@[INSTANCE_NAME]:[REMOTE_FILE_PATH] "[LOCAL_DESTINATION]"
Example:
gcloud compute scp root@instance-20250724-130147:/var/virtru/cks/send_to_virtru.tar.gz "C:\Users\prince.vonleh\Downloads\"The LOCAL_DESTINATION should be wrap in quotes.
The username and instance information is found on your server.
gcloud compute scp prince_vonleh@virtru001servername-cks:/var/virtru/cks/send_to_virtru.tar.gz \Users\prince.vonleh\Downloads\Hit enter to download the file.
Additional Tips
- If you encounter permission issues, ensure you have the correct permissions on the remote server to access the file.
- If the download doesn't start, double-check the path to the file on the remote server and the specified download location for any typos.
Option 4:
Alternatively, you can utilize WinSCP to transfer files from your server to a local folder.
By following these steps, readers should be able to successfully download the 'send_to_virtru.tar.gz' file from the remote server to their local machine using SCP.