How to Enable SSH Server on Windows 10?
Make certain your build of Windows 10 is 1809 or newer. The easiest way to do this is by running the command :
winver
Note. If you have an older Windows 10 build installed, you can update it through Windows Update or using an ISO image with a newer translation of Windows 10 ( you can create an prototype using the Media Creation Tool ). If you don ’ thymine want to update your Windows 10 build, you can manually install the Win32-OpenSSH port for Windows with GitHub .
You can enable OpenSSH waiter in Windows 10 through the graphic Settings panel :
- Go to the Settings > Apps > Apps and features > Optional features (or run the command ms-settings:appsfeatures);
- Click Add a feature, select OpenSSH Server (OpenSSH-based secure shell (SSH) server, for secure key management and access from remote machines), and click Install
You can besides install sshd server using PowerShell :
Add-WindowsCapability -Online -Name OpenSSH.Server*
Or using DISM :
dism /Online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0
If you want to make sure the OpenSSH server is installed, run the following PS dominate :
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Server*' Name : OpenSSH.Server~~~~0.0.1.0 State : Installed
Use the following PowerShell instruction to uninstall the SSH server :
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
How to Install SSH Server on Windows 11?
besides, you can add the OpenSSH Server on Windows 11 .
- Go to Settings > Apps > Optional features;
- Click View Features;
- Select OpenSSH Server from the list and click Next > Install;
- Wait for the installation to complete.
The OpenSSH binaries are located in the C : \Windows\System32\OpenSSH\ booklet.
Configuring SSH Service on Windows 10 and 11
Check the status of ssh-agent and sshd services using the PowerShell control Get-Service :
Get-Service -Name *ssh*
As you can see, both services are in a Stopped state and not added to the automatic startup list. To start services and configure autostart for them, run the follow commands :
Start-Service sshd Set-Service -Name sshd -StartupType 'Automatic' Start-Service ‘ssh-agent’ Set-Service -Name ‘ssh-agent’ -StartupType 'Automatic'
You besides need to allow incoming connections to TCP port 22 in the Windows Defender Firewall. You can open the port using netsh :
netsh advfirewall firewall add rule name=”SSHD service” dir=in action=allow protocol=TCP localport=22
Or you can add a firewall rule to allow SSH dealings using PowerShell :
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
now you can connect to Windows 10 using any SSH client. To connect from Linux, use the dominate :
Read more: How to register as a VIP in GTA Online
ssh -p 22 admin@192.168.1.90
here, the admin is a local Windows drug user under which you want to connect. 192.168.1.90 is an IP savoir-faire of your Windows 10 calculator. After that, a new Windows command immediate window will open in SSH session.
Hint. To run the PowerShell.exe command line interface alternatively of cmd.exe shell when log in via SSH on Windows 10, you need to run the following command in Windows 10 ( under admin score ) :
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
immediately, you change the nonpayment OpenSSH shell. From here, when connecting to Windows via SSH, you will immediately see PowerShell motivate alternatively of cmd.exe. If you want to use key-based ssh authentication alternatively of password authentication, you need to generate a key using ssh-keygen on your client. then, the contents of the id_rsa.pub file must be copied to the vitamin c : \users\admin\.ssh\ authorized_keys file in Windows 10. After that, you can connect from your Linux node to Windows 10 without a password. Use the command :
ssh -l admin@192.168.1.90
You can configure assorted OpenSSH waiter settings in Windows using the % programdata % \ssh\ sshd_config configuration file. For exemplar, you can disable password authentication and leave merely key-based auth with :
PubkeyAuthentication yes PasswordAuthentication no
here you can besides specify a new TCP larboard ( rather of the default option TCP 22 port ) on which the SSHD will accept connections. For model :
Port 2222
Using the directives AllowGroups, AllowUsers, DenyGroups, DenyUsers, you can specify users and groups who are allowed or denied to connect to Windows via SSH :
- DenyUsers theitbros\jbrown@192.168.1.15 — blocks connections to username jbrown from 192.168.1.15 hostsж
- DenyUsers theitbros\* — prevent all users from theitbros domain to connect host using sshж
- AllowGroups theitbros\ssh_allow — only allow users from theitbtos\ssh_allow connect hostю
The allow and deny rules of sshd are processed in the follow order : DenyUsers, AllowUsers, DenyGroups, and AllowGroups. After making changes to the sshd_config file, you need to restart the sshd service :
Get-Service sshd| Restart-Service –force
In previous versions of OpenSSH on Windows, all sshd military service logs were written to the text file C : \ProgramData\ssh\logs\sshd.log by default. On Windows 11, SSH logs can be viewed using the Event Viewer console ( eventvwr.msc ). All SSH events are available in a separate section Application and Services Logs > OpenSSH > Operational. For case, the screenshot shows an exemplar of an event with a successful connection to the calculator via SSH. You can see the ssh customer ’ s IP address ( hostname ) and the username used to connect.
Sshd : accept password for jbrown from 192.168.14.14. port 49833 ssh2