Generating SSH keys

Generating SSH keys

Introduction

This tutorial will demonstrate how to generate a SSH key pair which is required to access an Application. In addition, this document describes how to access a running Application from multiple different SSH keys. 

We will use Ubuntu 20.04 Application Bundle for this example.

Generate a SSH key pair 

To access an Application you must provide your SSH key before you can connect. If you do not have a key, you can create one follow the instructions blow. 

Linux and macOS

1.  Log into the computer you will use to access your application with, and from the command line generate a key pair using RSA.

            To generate RSA keys enter: ssh-keygen -t rsa

2.  You will be prompted to provide a filename and a password: 
  1. Filename: Press Enter or Return without entering a filename to accept the default filename and location for your key pair (~/.ssh/id_rsa). 
  2. Password: Input a password that contains a minimum of five (5) characters, press Enter or Return to set your password. Press Enter or Return without inputing a password to generate a private key that is not password protected.
    NOTE: it is common to not use a password because your desktop operating system already has authentication requirements.

Windows

To install the OpenSSH components:

1.  Open Settings, select Apps, then select Optional Features.
2.  Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select Add a feature, then:
  1. Find OpenSSH Client, then select Install
  2. Find OpenSSH Server, then select Install
Once setup completes, return to Apps and Optional Features and you should see OpenSSH listed.

3. To generate the RSA key, run the following command from a PowerShell or cmd prompt on your client:
  1. ssh-keygen -t rsa -b 4096

Launch application

Launch and connect to a Ubuntu application. For additional documentation please refer to Running your first application.

Graphical user interface, application, TeamsDescription automatically generated

Add additional SSH Keys to the application

You can grant SSH access to a running Application by appending new public keys to the authorized_keys file.
  1. Display your public key by running: cat ~/.ssh/id_rsa.pub (note: SSH key must be named id_rsa.pub)
  2. Add the public key to the Application's authorized_keys file (~/.ssh/authorized_users) using your preferred editor like vim or nano. 
  3. You can optionally "echo" the SSH key on the command prompt and re-direct the output by running: echo {pubkey} >> ~/.ssh/authorized_users.  Replace {pubkey} with your actual public key located in the id_rsa.pub file on your local machine.



    • Related Articles

    • Connect to GitHub using SSH keys

      As of August 2021, GitHub has removed support for Password Authentication while using HTTPS protocol. It is convenient (and recommended) to access GitHub repos securely using SSH Keys. Generate a public/private RSA key pair Skip to next step if you ...
    • Running your first application

      This tutorial will use the PyTorch 1.8.2 application which provides a Ubuntu command line and JupyterLab web interface for development. Select application bundle Navigate to 'Applications' then 'Bundles' and select an application to deploy. Name your ...
    • Application bundles

      Overview Denvr Dataworks offers a new type of application deployment called "Application Bundles". An application bundles packages together all resources necessary to operate a user application, including: Application code in the form of containers ...
    • Transferring data files using SFTP

      Introduction This tutorial will demonstrate use of SFTP (Secure File Transfer Protocol) to transfer files into an application instance. Files can be read/write to the operating system disks or the Denvr Storage platforms using the /data/ filesystem. ...