• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
iGuRu

iGuRu

Real-time Technology News. Opinions & Tweaks

  • / news
  • / infosec
  • / tools
  • / tweaks
  • / dummies
  • / opinions
  • / support
home / tweaks / Log in to Windows 10 via SSH

Log in to Windows 10 via SSH

17/05/2020 19:23 by Dimitris

In this article, we will show you how to set up OpenSSH in Windows 10 and connect to them via SSH using Putty or any other SSH client.

 

ssh windows - Connect to Windows 10 via SSH

The latest versions of Windows 10 include a built-in SSH server and an OpenSSH-based client. This means you can now connect to Windows 10 remotely using any SSH client, as in a Linux distribution. Let's see how.

Step 1: Make sure the version of Windows 10 is 1809 or newer. The easiest way to do this is to open a command prompt window and run the command:
winver

ssh 1 - Log in to Windows 10 via SSH

Note: If you have an older version of Windows 10 installed, you can update it through Windows Update or using an ISO image with a newer version of Windows 10. If you do not want to update your version of Windows 10, you can install Win32 manually. -OpenSSH port for Windows from GitHub (https://github.com/PowerShell/Win32-OpenSSH) and avoid Step 2.

Step 2: Install the OpenSSH server in Windows 10 via the configuration panel:
Go to Settings> Applications> Options.
ssh 2 - Log in to Windows 10 via SSH

Click + Add Feature, scroll down the list and find it OpenSSH server (Secure shell server (SSH) based on OpenSSH, for secure key management and access from remote machines).
ssh 3 - Log in to Windows 10 via SSH

Click on it and press the "Install" button

You can also install the sshd server using PowerShell:

Add-WindowsCapability -Online -Name OpenSSH.Server & Hosting*

ssh 4 - Log in to Windows 10 via SSH

Ή using DISM:

Dism /Online /Add-Capability /CapabilityName:OpenSSH.Server & Hosting~~~~0.0.1.0

If you want to make sure the OpenSSH server is installed, open one PowerShell window and execute the following command:

Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Server *'

ssh 5 - Log in to Windows 10 via SSH

Step 3: Check the status of ssh-agent and sshd services using the PowerShell Get-Service command:

Get-Services -Name *ssh*

ssh 6 - Log in to Windows 10 via SSH

Step 4: As you can see, both services are in downtime and are not added to the auto-start list. To start the services and set the auto-start for them, run the following commands, one by one:

Start-Service sshd

Set-Services -Name sshd -StartupType 'Automatic'

Start-Service ssh-agent

Set-Services -Name ssh-agent -StartupType 'Automatic'

ssh 7 - Log in to Windows 10 via SSH

you should also allow incoming connections to TCP port 22 on Windows Defender Firewall (if enabled):

netsh advfirewall firewall add rule name=SSHD service dir=in action=allow protocol=TCP localport=22

Step 5: You can now connect to Windows 10 using any SSH client. To connect from Linux, use the command:

ssh -p 22 [email protected]192.168.1.90

where admin enter the local Windows user to whom you want to connect and where 192.168.1.90 enter the LOCAL IP address of your Windows 10 computer.

Note: The above example refers to a connection within a local private network (intranet). If you want to connect from another network you need to make settings on your router so that the demand on port 22 leads to the specific Windows computer, as well as to know at all times the external IP provided by your provider.

ssh 8 - Log in to Windows 10 via SSH

A successful connection will open a new Windows command prompt window.

Trick: To run the PoweShell console instead of the command prompt (cmd.exe) when connecting via SSH in Windows 10, you must run the following command in Windows 10 (under admin account):

New-ItemProperty -Path HKLM:\ SOFTWARE \ OpenSSH -Name DefaultShell -Value C:\ Windows \ System32\ WindowsPowerShell \ v1.0\ powershell.exe -PropertyType String Force

So you change the default OpenSSH shell in the registry. Now, when you connect to Windows via SSH, you will immediately see the PowerShell prompt instead of cmd.exe.
ssh 9 - Log in to Windows 10 via SSH

If you want to use key-based ssh authentication instead of password authentication, you must create a key using ssh-keygen on your client.

Then the contents of the id_rsa.pub file must be copied to the C: \ Users \ Admin \ .ssh \ authorized_keys file in Windows 10.

After that, you can sign in from the Linux client computer in Windows 10 without a password. Use the command:

ssh -l [email protected]192.168.1.90

You can configure various OpenSSH server settings in Windows using the %% programdata% \ ssh \ sshd_config configuration file.
ssh 10 - Log in to Windows 10 via SSH

For example, you can turn off password authentication and leave only key authorization with:

PubkeyAuthentication yes

PasswordAuthentication no
Log in to Windows 10 via SSH was last modified: 17 May, 2020, 7: 23 mm by Dimitris

Subscribe to our newsletter

no spam

spread the news

  • Facebook
  • Twitter
  • Reddit
  • Printing
  • Email

Read them Technology News from all over the world, with the validity of iGuRu.gr

Follow us on Google News


Competition: tweakstag: client, openssh, powershell, putty, SSH, windows

You May Also Like

What does Ctrl + Z do? More than you think
Troubleshoot oobekeyboard and BIOS problems
Patch Tuesday February (56 vulnerabilities - one 0day)

About Us Dimitris

Dimitris hates on Mondays .....

Previous Post: « Ultra Adware Killer Ultra Adware Killer 7.9.1.0 Free for everyone
Next Post: Firefox 84 December 2020 ends Flash Firefox 84 December 2020 ends Flash »

Reader Interactions

Comment Policy:

IGuRu.gr does not publish the comments immediately. Malicious comments, comments that include ads, or comments that are offensive are deleted without notice. We do not adopt the opinions expressed by our readers.
Your comments will be displayed after approval by the administrators


Leave your comment
Ακύρωση απάντησης

Your email address is not published. Τα υποχρεωτικά πεδία σημειώνονται με *

 

 © 2021 · iGuRu.gr · ☢ · Keep It Simple Stupid Genesis theme

about  ·   get in touch  ·  rss  ·  sitemap  ·  cough

loadingCancel
Could not post post - check your email address!
Email verification failed, please try again
Your blog can not post posts via email.