Topics Map > •Research Computing

Using OpenSSH from Windows Powershell with ORION virtual machines

How to use OpenSSH keys for authentication/login to ORION virtual machines using Windows 10 Powershell

ORION Virtual Machines are configured by default to utilize OpenSSH key exchanges for authentication, rather than passwords.  In the past, Windows systems required third-party software to handle SSH keys, however, Windows 10 now has built-in OpenSSH support in the PowerShell. 

  • To get started, run PowerShell as admin and type the following; this will allow you to manually start the ssh-agent from user space:
    • Command
      Windows PowerShell
      Copyright (C) Microsoft Corporation. All rights reserved.


      Try the new cross-platform PowerShell https://aka.ms/pscore6


      PS C:\Windows\system32> Get-Service -Name ssh-agent | Set-Service -StartupType Manual
      PS C:\Windows\system32>
  • In a separate PowerShell window, generate your ssh key & provide a passphrase. Your private and public keys will be stored in the .ssh directory by default. You can use the command ‘cat’ to show the contents of the key files.
    • Command
      PS C:\Users\netID.ADRICE> ssh-keygen.exe
      Generating public/private rsa key pair.
      Enter the file in which to save the key (C:\Users\netID.ADRICE/.ssh/id_rsa):
      Created directory 'C:\Users\netID.ADRICE/.ssh'.
      Enter passphrase (empty for no passphrase):
      Enter the same passphrase again:
      Your identification has been saved in C:\Users\netID.ADRICE/.ssh/id_rsa.
      Your public key has been saved in C:\Users\netID.ADRICE/.ssh/id_rsa.pub.
      The key fingerprint is:
      SHA256:CsiswhDb10IjhCMy7JMZHUNZvW8K/LceEHZrPfchDBs adrice\netID@DESKTOP-OU6HJ3D
      The key's random art image is:
      +---[RSA 2048]----+
      |..+++.. |
      |*+ o. . |
      |=o= o o.. E |
      | @ + o..o o = |
      |o * = ..So + + . |
      |o. . = .oo o o .|
      |o. + o. . |
      |. o .. |
      | oo. |
      +----[SHA256]-----+
      PS C:\Users\netID.ADRICE> cd .ssh
      PS C:\Users\netID.ADRICE\.ssh> dir


      Directory: C:\Users\netID.ADRICE\.ssh


      Mode LastWriteTime Length Name
      ---- ------------- ------ ----
      -a---- 9/29/2020 1:37 PM 1766 id_rsa
      -a---- 9/29/2020 1:37 PM 412 id_rsa.pub


      PS C:\Users\netID.ADRICE\.ssh> cat .\id_rsa.pub
      ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7J adrice\netID@DESKTOP-OU6HJ3D
  • In the ORION web console, go to the drop-down for your user profile in the upper right-hand corner, and select Settings: Update SSH Key.
  • Copy the contents of id_rsa.pub, as seen above, into the text box and click the “Update SSH Key” button.  Any VM that you create in ORION will automatically have this public key added to your account’s authorized_keys file when it is instantiated. 
  • Note that you MUST do this step prior to creating any ORION VMs, otherwise, they will not get your ssh key installed and you won’t be able to login to them remotely.
    • Orion SSH Key Dialog
  • On your Windows system, start the local ssh-agent which will store your session keys:
    • Command
      PS C:\Users\netID.ADRICE\.ssh> ssh-agent


      Add the key to your agent keychain, providing the key password:


      PS C:\Users\netID.ADRICE\.ssh> ssh-add id_rsa
      Enter passphrase for id_rsa:
      Identity added: id_rsa (id_rsa)
  • Now, you should be able to ssh to the ORION virtual machine’s IP address, which can be found on the ORION dashboard for each VM:


    ORION Virtual Machine IP Address
  • Note that you will need to use your NetID when sshing in, since the account created on the new VM matches your NetID.
    • Command
      PS C:\Users\netID.ADRICE\.ssh> ssh netID@10.134.196.60
      Warning: Permanently added '10.134.196.60' (ECDSA) to the list of known hosts.
      Last login: Fri Jul 30 13:17:10 2021 from 10.66.64.247
      [netID@orion-196-60 ~]$



Keywords:
ssh powershell windows keys orion openssh 
Doc ID:
114190
Owned by:
Clinton H. in Rice U
Created:
2021-10-08
Updated:
2023-05-04
Sites:
Rice University