LokerSSH.com – SSH (Secure Shell) is a popular protocol for securely accessing and managing remote systems over a network. While SSH has traditionally been associated with Linux or macOS, Windows 11 now supports SSH Server, allowing users to securely connect and manage their system remotely. Whether you are a developer, system administrator, or power user, enabling SSH Server on Windows 11 enhances remote management and security.
In this guide, we will walk you through the steps on how to use SSH Server on Windows 11, from installation to configuration, and provide tips on connecting remotely to your Windows 11 machine via SSH.
Why Use SSH Server on Windows 11?
1. Secure Remote Management
SSH encrypts all data transmitted between the client and server, ensuring secure remote connections. By enabling SSH Server on Windows 11, you can manage your system from anywhere with enhanced security, avoiding risks from less secure methods like RDP.
2. Command-Line Access
With SSH on Windows 11, you can remotely execute commands and scripts using PowerShell or the Command Prompt. This is beneficial for system administrators and developers who prefer working with the command line rather than relying on graphical interfaces.
3. Flexibility for Developers and IT Professionals
SSH enables easy automation and management of Windows 11 from another computer. Whether you’re debugging software, performing updates, or running diagnostics, SSH allows you to do all these tasks efficiently and securely.
Prerequisites for Using SSH Server on Windows 11
Before enabling SSH Server on your Windows 11 machine, ensure you have the following:
- Administrator Access: You need administrator privileges to install and configure SSH on your system.
- Windows 11 Version: SSH Server is supported natively on Windows 11, so no additional third-party software is required.
- Stable Internet Connection: Ensure you have internet access to download any necessary updates or features.
Steps to Set Up SSH Server on Windows 11
Step 1: Install OpenSSH Server on Windows 11
Windows 11 includes OpenSSH Server as an optional feature, but it needs to be manually enabled. Here’s how to install it:
1.1 Open Windows Settings
Click on the Start Menu and go to Settings. Alternatively, you can press Windows + I
to open the Settings window.
1.2 Access Optional Features
In the Settings window, go to Apps > Optional Features.
1.3 Add OpenSSH Server
Scroll down and click on Add a Feature. In the search bar, type OpenSSH Server. When it appears, click Install.
1.4 Verify Installation
Once the installation is complete, you can verify that OpenSSH Server was successfully installed by running the following command in PowerShell:
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH.Server*'}
If installed, it will show the OpenSSH Server as Installed.
Step 2: Start the OpenSSH Server
After installing the OpenSSH Server, you need to start it and configure it to start automatically with Windows 11.
2.1 Open PowerShell as Administrator
Right-click on the Start Menu and choose Windows Terminal (Admin) or PowerShell (Admin) to open it with administrator privileges.
2.2 Start the SSH Service
Run the following command in PowerShell to start the OpenSSH Server service:
Start-Service sshd
2.3 Enable SSH Server to Start Automatically
To ensure that the SSH server starts automatically every time Windows 11 boots up, use the following command:
Set-Service -Name sshd -StartupType 'Automatic'
Step 3: Allow SSH Through Windows Firewall
By default, Windows Firewall may block incoming connections on port 22, which is the default port for SSH. You need to create a firewall rule to allow SSH traffic.
3.1 Create a Firewall Rule for SSH
Run this command in PowerShell to open port 22 for SSH connections:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Protocol TCP -Action Allow -LocalPort 22
Step 4: Test SSH Server on Windows 11
4.1 Verify the SSH Service Status
To ensure that the SSH service is running, check its status with the following command:
Get-Service sshd
If the service is active, it should display Running.
4.2 Test SSH Access from Another Machine
From another computer (running Linux, macOS, or Windows), use an SSH client like PuTTY or the built-in SSH command to test the connection.
Open a terminal or PuTTY, and type the following:
ssh username@your-windows-ip
Replace username with your Windows 11 login name and your-windows-ip with the IP address of your Windows 11 machine.
If everything is set up correctly, you should be prompted for your password and then connected to your Windows 11 machine via SSH.
Step 5: Optional – Configure SSH Key Authentication
For enhanced security and convenience, you can set up SSH key-based authentication to log in without using a password.
5.1 Generate SSH Key Pair
Generate an SSH key pair on the machine from which you want to connect to the Windows 11 machine. On Linux or macOS, you can do this by running:
ssh-keygen
On Windows, you can use PuTTYgen to generate the key pair.
5.2 Copy the Public Key to Windows 11
Once the key pair is generated, copy the public key to the following directory on your Windows 11 machine:
C:\Users\<your-username>\.ssh\authorized_keys
If the .ssh
folder doesn’t exist, create it manually.
5.3 Modify SSH Configuration for Key Authentication
Edit the sshd_config file located at:
C:\ProgramData\ssh\sshd_config
Ensure that the following lines are uncommented:
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
5.4 Restart the SSH Service
After configuring key-based authentication, restart the SSH service with:
Restart-Service sshd
5.5 Test SSH Key Authentication
Now, you can connect to your Windows 11 machine using the private key:
ssh -i /path/to/private_key username@your-windows-ip
Troubleshooting SSH Server on Windows 11
- SSH Service Not Running: If the SSH service is not starting, run
Get-Service sshd
to check its status. Restart it withRestart-Service sshd
. - Firewall Issues: Ensure that port 22 is open in Windows Firewall. Use the
New-NetFirewallRule
command to create the rule if necessary. - Permission Issues: Make sure the
.ssh
folder andauthorized_keys
file have proper permissions. The.ssh
folder should have 700 permissions, and theauthorized_keys
file should have 600 permissions.
Conclusion
Enabling SSH Server on Windows 11 allows for secure, remote management of your system, making it easier for developers, IT administrators, and power users to work with their machines from anywhere. By following the steps outlined in this guide, you’ll be able to install, configure, and test SSH access on your Windows 11 system.
Whether you’re using SSH for secure remote connections, automating tasks, or accessing the Windows 11 command line remotely, the SSH Server is a powerful and essential tool for efficient management.