{"id":50830,"date":"2023-04-15T21:42:16","date_gmt":"2023-04-15T20:42:16","guid":{"rendered":"https:\/\/ekiwi-blog.de\/50830\/start-ssh-server-with-powershell-windows\/"},"modified":"2023-04-16T09:37:56","modified_gmt":"2023-04-16T08:37:56","slug":"start-ssh-server-with-powershell-windows","status":"publish","type":"post","link":"https:\/\/ekiwi-blog.de\/en\/50830\/start-ssh-server-with-powershell-windows\/","title":{"rendered":"Start SSH server with PowerShell (Windows)"},"content":{"rendered":"<p>Secure Shell (<abbr title=\"Secure Shell\">SSH<\/abbr>) is a cryptographic network protocol that is often used to establish secure connections between computers and networks, for example, for file transfers or to <a title=\"Tunnelling RDP via SSH\" href=\"https:\/\/ekiwi-blog.de\/en\/50644\/rdp-tunnelling-with-ssh\/\">establish SSH remote desktop connections<\/a>. Since Windows 10 and Windows Server 2019, Windows operating systems have a built-in OpenSSH server that allows you to make SSH connections to the Windows PC or server. In this article, we will show you how to start the OpenSSH server on Windows using PowerShell.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of content<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ekiwi-blog.de\/en\/50830\/start-ssh-server-with-powershell-windows\/#Step_1_Install_OpenSSH_server\" >Step 1: Install OpenSSH server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ekiwi-blog.de\/en\/50830\/start-ssh-server-with-powershell-windows\/#Step_2_Start_SSH_server_service\" >Step 2: Start SSH server service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ekiwi-blog.de\/en\/50830\/start-ssh-server-with-powershell-windows\/#Step_3_Start_SSH_server_service_automatically\" >Step 3: Start SSH server service automatically<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ekiwi-blog.de\/en\/50830\/start-ssh-server-with-powershell-windows\/#Step_4_Add_firewall_rule\" >Step 4: Add firewall rule<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ekiwi-blog.de\/en\/50830\/start-ssh-server-with-powershell-windows\/#Close\" >Close<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Step_1_Install_OpenSSH_server\"><\/span>Step 1: Install OpenSSH server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before you can start the SSH server, you need to make sure that OpenSSH is installed on your system. You can do this through PowerShell by following the steps below, or the <a title=\"Running SSH Server on Windows\" href=\"https:\/\/ekiwi-blog.de\/en\/50447\/set-up-ssh-server-under-windows\/\">SSH server can be installed manually using the optional features<\/a>.<\/p>\n<ol>\n<li>Open PowerShell <strong>as administrator<\/strong> by <strong>right-clicking<\/strong> on the Start menu and selecting <strong>&#8220;Windows PowerShell (Administrator)&#8221;<\/strong>.<\/li>\n<li>Run the following command to install the Windows OpenSSH Server feature:\n<pre><code><span style=\"colour: #ff6600;\"><span style=\"color: #ff6600;\">Add-WindowsCapability <\/span><\/span>-Online -Name OpenSSH.Server~~~~0.0.1.0<\/code><\/pre>\n<\/li>\n<li>Wait for the installation process to complete. You should see a message confirming that OpenSSH has been successfully installed.<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Step_2_Start_SSH_server_service\"><\/span>Step 2: Start SSH server service<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>After OpenSSH is installed on your system, you can start the SSH server service:<\/p>\n<p>In <a title=\"activate and deactive remote desktop with powershell\" href=\"https:\/\/ekiwi-blog.de\/en\/50859\/enable-and-disable-remote-desktop-with-powershell\/\">PowerShell<\/a> (Administrator), run the following command to start the SSH server service:<\/p>\n<pre><code><span style=\"colour: #ff6600;\"><span style=\"color: #ff6600;\">Start Service<\/span><\/span> sshd<\/code><\/pre>\n<p>To ensure that the service has started successfully, you can run the following command:<\/p>\n<pre><code><span style=\"color: #ff6600;\">Get-Service<\/span> sshd<\/code><\/pre>\n<p>If the status &#8220;<em>Running<\/em>&#8221; is displayed, it means that the SSH server service has been started successfully.<\/p>\n<figure id=\"attachment_50826\" aria-describedby=\"caption-attachment-50826\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-50826\" src=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2023\/04\/start-ssh-server-via-powershell.jpg\" alt=\"Screenshot Powershell Starting SSH Server\" width=\"650\" height=\"340\" srcset=\"https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2023\/04\/start-ssh-server-via-powershell.jpg 650w, https:\/\/ekiwi-blog.de\/wp-content\/uploads\/2023\/04\/start-ssh-server-via-powershell-300x157.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><figcaption id=\"caption-attachment-50826\" class=\"wp-caption-text\">Start SSH server <a title=\"WindowsApps: Setting up access via Powershell\" href=\"https:\/\/ekiwi-blog.de\/en\/26839\/windowsapps-setting-up-access-via-powershell\/\">via PowerShell<\/a> and check status<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Step_3_Start_SSH_server_service_automatically\"><\/span>Step 3: Start SSH server service automatically<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To start the SSH server service automatically when Windows boots up, the following command can also be run:<\/p>\n<pre><code><span style=\"color: #ff6600;\">Set-Service<\/span> -Name sshd -StartupType 'Automatic'<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Step_4_Add_firewall_rule\"><\/span>Step 4: Add firewall rule<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In most cases, the <a title=\"Windows: Allow ping in Windows firewall\" href=\"https:\/\/ekiwi-blog.de\/en\/18584\/windows-allow-ping-in-windows-firewall\/\">Windows firewall<\/a> rule set should already fit after installing the SSH server. If not, the following firewall rules need to be added to make the SSH server reachable from other computers on the network:<\/p>\n<pre><code><span style=\"color: #ff6600;\">New<\/span>-NetFirewallRule -Name 'OpenSSH Server' -DisplayName 'OpenSSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Close\"><\/span>Close<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now you have successfully started the OpenSSH server on Windows using PowerShell. You can now make SSH connections to your Windows PC or server from other computers on the network or over the <a title=\"Timeout during PPP negotiation\" href=\"https:\/\/ekiwi-blog.de\/en\/26493\/timeout-during-ppp-negotiation\/\">Internet<\/a>. Remember that you need a username and password or an SSH key pair to access the SSH server.<\/p>","protected":false},"excerpt":{"rendered":"<p>Secure Shell (SSH) is a cryptographic network protocol that is often used to establish secure connections between computers and networks,<\/p>\n","protected":false},"author":2,"featured_media":23339,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1555],"tags":[2832,1992,2893,2838,2068],"class_list":["post-50830","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-en","tag-openssh-en","tag-powershell","tag-script-en","tag-ssh-en","tag-windows-en-2"],"_links":{"self":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/50830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/comments?post=50830"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/posts\/50830\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media\/23339"}],"wp:attachment":[{"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/media?parent=50830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/categories?post=50830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi-blog.de\/en\/wp-json\/wp\/v2\/tags?post=50830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}