I like to have a linux machine for some lab stuff which I can access from multiple machines prefereably over SSH. Because Windows 10 ships with an integrated SSH client and Windows Terminal looks just awesome I wanted to use Windows Terminal to access my linux machine running on Azure over SSH. Today I’d like to show you my setup.
Generate a Key Pair#
1
2
3
4
5
6
7
8
| ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\NicolaSuter/.ssh/id_rsa):
Created directory 'C:\Users\NicolaSuter/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\NicolaSuter/.ssh/id_rsa.
Your public key has been saved in C:\Users\NicolaSuter/.ssh/id_rsa.pub.
|
Add SSH config file#
C:\Users\%USERNAME%\.ssh\config
1
2
3
4
5
| Host horus
Hostname horus.nicolonsky.ch
Port 22
User azureuser
IdentityFile ~/.ssh/id_rsa
|
Test the SSH connection#
ssh horus
Windows Terminal Configuration#
Create a new GUID with Powershell and the command: (New-Guid).Guid
1
2
3
4
5
6
7
| {
"guid": "{67d39a21-70ff-4bdd-af09-fd68b29c1716}",
"name": "Horus",
"commandline": "ssh horus",
"hidden": false,
"icon": "https://image.flaticon.com/icons/png/512/119/119423.png"
},
|
Sync Windows Terminal Settings with OneDrive#
We can setup a symlink to use the Windows Terminal Config stored in OneDrive:
1
| New-Item -ItemType SymbolicLink -Path "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -Target "$env:OneDrive\Encrypted_Zone\settings.json" -Force
|
Howto keep ssh config in sync between machines#
To sync the SSH settings we can configure a Junction:
1
| New-Item -ItemType Junction -Path "$env:USERPROFILE\.ssh" -Target "$env:OneDrive\Encrypted_Zone\.ssh\"
|
1
2
3
4
5
| Get-Item "$env:USERPROFILE\.ssh\" | Select-Object FullName, LinkType, Target
FullName LinkType Target
-------- -------- ------
C:\Users\nicola.suter\.ssh\ Junction {C:\Users\nicola.suter\OneDrive - Nicolonsky Tech\Encrypted_Zone\.ssh\}
|