Upload data using SCP command

SCP (secure copy) is a command-line utility that allows you to securely copy files and directories between two locations. With scp , you can copy a file or directory: From your local system to a remote system.

It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol. SCP is known for its simplicity, security and pre-installed availability.

When you launch an instance on Q Blocks, you can access it either through Jupyter Lab or through Terminal SSH.

SSH access to your Q Blocks instances is controlled via:

  1. Password, and

  2. Secure public private key pair

While accessing your instance, you can download your private SSH key or use password for authentication. For the sake of this SCP example, we will use SSH Key based authentication.

To get started, please follow the steps mentioned below:

  1. Go to the instances page in your Q Blocks Dashboard.

  2. Click on "Select an action" button on your instance and then choose the "Connect" option

  3. Copy the SSH port of your instance as shown in the image below:

  1. Copy the Hostname of your instance:

    • In the above image, you can see our example hostname is: jeu.qblocks.cloud.

    • It will be different in your case but you need to copy your hostname for running scp command.

  2. Go to your terminal and execute the following scp command:

scp -i /PATH/TO/SSH/KEY -P SSH_PORT /PATH/TO/LOCAL_FILE qblocks@HOSTNAME:/home/qblocks/
  1. In the above command we specify the following:

    • /PATH/TO/SSH/KEY for using it as authentication.

    • SSH_PORT is our instance's SSH Port.

    • /PATH/TO/LOCAL_FILE is the source path of the file that will be uploaded using SCP. You may even specify a folder path for upload.

    • qblocks is the default user of your instance. You can create new users as well in your instance and use its password or ssh key for scp.

    • HOSTNAME is your instance's hostname.

    • /home/qblocks/ is the destination path where you want the data to be uploaded in your instance. You may specify any particular existing path in your instance as a destination path.

    This should help you quickly upload any file or data to your Q Blocks instance using scp.

    If you still face issues then don't hesitate to reach out to us at: support@qblocks.cloud.

Last updated