Windows Server 2022 Jumpbox
This guide is to connect to a Windows server through SSH (13min setup required).
I. Install Open SHH
On the Windows server, open the Settings and go to Apps.
Go to Optional Features.
Install OpenSSH Server.
II. Switch On OpenSSH Server
Open Computer Management application.
Go into Services and Applications > Services.
Click on OpenSSH Server.
Set Startup type to Automatic and click on Start.
Keep this window open, we will have to come back to it soon.
III. Set Up OpenSSH Server
Open a terminal with Administrator role
Open the OpenSSH Server config file by running:
notepad "C:\ProgramData\ssh\sshd_config"
Uncomment PubkeyAuthentication.
Uncomment PasswordAuthentication and set it to no.
Comment the 2 last lines of the file (Match Group Administrator).
Save and quit the file. If you cannot save, you most certainly did not open the terminal as an Administrator, you need to open a new terminal with Administrator rights and redo the configuration changes done in this section.
In the Computer Management window, restart the OpenSSH Server.
IV. Upload the Public SSH key of the server you want to connect from
Go in Users and go in the folder associated with the Windows user you want to connect with
Create a new folder
.ssh
In this newly created folder, create an empty text file
authorized_keys
By default, text files are created with a
.txt
extension, we need to remove it.Click View in the header bar.
Tick the checkbox
File name extensions
The
.txt
file extension should now be visible.Rename the file to remove the file extension. You can safely ignore the warning.
Add the PUBLIC SSH key of the server that you want to grant access to this Windows server we are currently configuring. The public key is of the form:
ssh-<encryption_algorithm> <key>
.
V. Test
Try connecting through SSH to the windows instance we just setup:
where:
-i <path_to_ssh_private_key_of_client>
: Specifies the private key file for authentication of the client, not of the windows machine. The private key file should be readable and writable only by its owner and should be of the form:
ssh_user
: the Windows User for which you uploaded the client public key. In the screenshots above it is 'alexis'.<windows_server_public_ip>
: The public IP address of the Windows server.
You should now have been able to access this Windows server through SSH 🎉 If you are blocked or have any question, feel free to reach out to us at hello@stacksync.com we're happy to help!
Troubleshooting of common errors
Last updated