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 ssh-agent from user space:
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
- 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.
PS C:\Users\netID.ADRICE> ssh-keygen.exe
Generating public/private rsa key pair.
Enter 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 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:
The key's randomart image is:
|*+ o. . |
|=o= o o.. E |
| @ + o..o o = |
|o * = ..So + + . |
|o. . = .oo o o .|
|o. + o. . |
|. o .. |
| oo. |
PS C:\Users\netID.ADRICE> cd .ssh
PS C:\Users\netID.ADRICE\.ssh> dir
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 MUSTdo 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.
- On your Windows system, start the local ssh-agent which will store your session keys:
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:
- Note that you will need to use your NetID when sshing in, since the account created on the new VM matches your NetID.
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