LokerSSH.com – SSH (Secure Shell) is a protocol widely used to securely connect to remote servers and manage them via the command line. While SSH is commonly associated with Linux and macOS, Windows 11 also supports SSH natively, allowing users to securely access remote machines. Enabling SSH on Windows 11 can make it easier for developers and system administrators to manage remote systems.
In this article, we’ll walk you through the step-by-step process of enabling SSH on Windows 11, whether you’re using it for remote server management, secure file transfers, or other administrative tasks.
Why Enable SSH on Windows 11?
1. Remote Access to Servers
SSH provides a secure, encrypted connection to remote servers, allowing you to manage them from anywhere. By enabling SSH on Windows 11, you can connect to Linux servers, Windows servers, or any remote machine that supports SSH, making it easier to manage servers remotely without needing to access them physically.
2. Secure Communication
Unlike older protocols like Telnet or RDP, SSH encrypts data during transmission, protecting your credentials and commands from being intercepted. This makes SSH a more secure choice for remote connections and management.
3. Command-Line Management
With SSH enabled on Windows 11, you can access the Windows Subsystem for Linux (WSL) or manage remote systems through the terminal. Developers and IT professionals often prefer SSH for running scripts, performing updates, or troubleshooting systems remotely.
Prerequisites for Enabling SSH on Windows 11
Before proceeding with the setup, ensure the following:
- Administrator Privileges: You must have administrator access to enable SSH on Windows 11.
- Windows 11 Pro or Home: SSH is supported on both Windows 11 Pro and Home editions. The steps remain the same for both editions.
- Internet Connection: Ensure that you have a stable internet connection for downloading any necessary features.
How to Enable SSH on Windows 11
Step 1: Install OpenSSH Client and Server on Windows 11
Windows 11 comes with OpenSSH built into the system, but you may need to enable the SSH client and OpenSSH Server manually if they aren’t already installed.
1.1 Open Settings
Click on the Start Menu and select Settings (or press Windows + I
to open Settings).
1.2 Go to Optional Features
In the Settings window, click on Apps in the left sidebar. Then, click on Optional Features under the “Apps & Features” section.
1.3 Add Optional Feature
Scroll down and click on Add a Feature. A list of optional features will appear.
1.4 Install OpenSSH Client
Search for OpenSSH Client in the list. Select it and click Install. The OpenSSH Client is what allows you to make SSH connections from your Windows 11 machine.
1.5 Install OpenSSH Server
To install the OpenSSH Server, search for OpenSSH Server in the same list and click Install. This will enable your Windows 11 machine to act as an SSH server.
Step 2: Start and Enable the SSH Server
Once you’ve installed the OpenSSH Client and OpenSSH Server, you need to start the SSH server and configure it to start automatically with Windows.
2.1 Open PowerShell as Administrator
To do this, press Windows + X
, then select Windows Terminal (Admin) or PowerShell (Admin) from the menu.
2.2 Start the SSH Server
Run the following command to start the OpenSSH Server:
Start-Service sshd
2.3 Set SSH to Start Automatically
To ensure that the SSH server starts automatically every time your computer reboots, run the following command:
Set-Service -Name sshd -StartupType 'Automatic'
Step 3: Allow SSH Through the Firewall
By default, Windows Firewall might block incoming connections on port 22 (the default SSH port). To allow SSH connections, you need to create a rule in Windows Firewall to open port 22.
3.1 Create a Firewall Rule for SSH
Run the following command in PowerShell to allow SSH traffic through the firewall:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Protocol TCP -Action Allow -LocalPort 22
Step 4: Verify SSH is Working
4.1 Check SSH Service Status
To verify that the SSH service is running, you can check its status using the following command:
Get-Service sshd
If SSH is running, you should see the status as Running.
4.2 Test the SSH Connection
You can now test SSH on your Windows 11 system by using an SSH client (like PuTTY or the built-in SSH command in Linux or macOS). From another computer, run the following command to connect to your Windows 11 system via SSH:
ssh username@your-windows-ip
Replace username with your Windows 11 username and your-windows-ip with the IP address of your Windows 11 machine. If you set everything up correctly, you should be prompted for your password and then connected to your Windows machine via SSH.
Step 5: Optional – Set Up SSH Key Authentication
For better security, you can configure SSH key-based authentication instead of using passwords. Here’s how to set it up:
5.1 Generate an SSH Key Pair
On the machine you’re using to connect to Windows 11, generate an SSH key pair. On Linux or macOS, you can generate it using the following command:
ssh-keygen
On Windows, you can use PuTTYgen to generate the key pair.
5.2 Copy the Public Key to Windows 11
Copy the public key to the C:\Users\<your-username>\.ssh\authorized_keys
file on your Windows 11 machine. If the .ssh
folder doesn’t exist, you can create it manually.
5.3 Configure the SSH Server for Key Authentication
Ensure that the SSH server is set to allow key-based authentication by checking the sshd_config file. Open the file:
C:\ProgramData\ssh\sshd_config
Make sure the following lines are present (uncommented):
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
5.4 Restart the SSH Service
Restart the SSH service to apply the changes:
Restart-Service sshd
5.5 Test Key-Based Authentication
Now, you can use your private key to authenticate:
ssh -i /path/to/private_key username@your-windows-ip
Troubleshooting Tips
- SSH Service Not Starting: If the SSH service isn’t starting, check for errors by running
Get-Service sshd
to verify the status. Try restarting the service withRestart-Service sshd
. - Firewall Issues: Ensure port 22 is open on your firewall. Run the
New-NetFirewallRule
command if necessary. - Permission Issues: Make sure the
.ssh
directory andauthorized_keys
file have the correct permissions. The.ssh
folder should be owned by your user and should have 700 permissions, and theauthorized_keys
file should have 600 permissions.
Conclusion
Enabling SSH on Windows 11 opens up secure and efficient ways to remotely manage your system, whether you’re an IT administrator, developer, or just someone looking for a more secure connection method. By following the steps in this guide, you’ll be able to set up OpenSSH, start the server, allow incoming connections, and even configure key-based authentication for added security.
With SSH enabled on Windows 11, you can remotely access your machine with ease, making it a powerful tool for both personal and professional use.