How to install openssh on windows 7

How to install openssh on windows 7

Get started with OpenSSH for Windows

Applies to: Windows Server 2022, Windows Server 2019, Windows 10 (build 1809 and later)

OpenSSH is a connectivity tool for remote sign-in that uses the SSH protocol. It encrypts all traffic between client and server to eliminate eavesdropping, connection hijacking, and other attacks.

An OpenSSH-compatible client can be used to connect to Windows Server and Windows client devices.

If you downloaded the OpenSSH beta from the GitHub repo at PowerShell/Win32-OpenSSH, follow the instructions listed there, not the ones in this article. Some information in the Win32-OpenSSH repository relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided there.

Prerequisites

Before you start, your computer must meet the following requirements:

Prerequisites check

To validate your environment, open an elevated PowerShell session and do the following:

Type winver.exe and press enter to see the version details for your Windows device.

Run the command below. The output will show True when you’re a member of the built-in Administrators group.

Install OpenSSH for Windows

Both OpenSSH components can be installed using Windows Settings on Windows Server 2019 and Windows 10 devices.

To install the OpenSSH components:

Open Settings, select Apps, then select Optional Features.

Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select Add a feature, then:

Once setup completes, return to Apps and Optional Features and you should see OpenSSH listed.

To install OpenSSH using PowerShell, run PowerShell as an Administrator. To make sure that OpenSSH is available, run the following cmdlet:

The command should return the following output if neither are already installed:

Then, install the server or client components as needed:

Both commands should return the following output:

To start and configure OpenSSH Server for initial use, open an elevated PowerShell prompt (right click, Run as an administrator), then run the following commands to start the sshd service :

Connect to OpenSSH Server

Once installed, you can connect to OpenSSH Server from a Windows or Windows Server device with the OpenSSH client installed. From a PowerShell prompt, run the following command.

Once connected, you get a message similar to the following output.

Entering yes adds that server to the list of known SSH hosts on your Windows client.

At this point, you’ll be prompted for your password. As a security precaution, your password won’t be displayed as you type.

Once connected, you’ll see the Windows command shell prompt:

Uninstall OpenSSH for Windows

To uninstall OpenSSH using Windows Settings:

To uninstall the OpenSSH components using PowerShell, use the following commands:

You may need to restart Windows afterwards if the service was in use at the time it was uninstalled.

Next steps

Now that you’ve installed OpenSSH Server for Windows, here are some articles that might help you as you use it:

Установка OpenSSH

Область применения Windows Server 2019, Windows 10: Windows Server 2022,

OpenSSH — это средство подключения для удаленного входа, использующее протокол SSH. Оно шифрует весь трафик между клиентом и сервером для предотвращения перехвата информации, перехвата подключения и других атак.

OpenSSH можно использовать для подключения устройств с Windows 10 (версия 1809 и более поздние) или Windows Server 2019 с установленным клиентом OpenSSH к таким устройствам с установленным сервером OpenSSH.

Если вы скачали OpenSSH из репозитория GitHub по адресу PowerShell/openssh-portable, следуйте приведенным в репозитории инструкциям, а не инструкциям в этой статье.

Установка OpenSSH с помощью приложения «Параметры» в Windows

Оба компонента OpenSSH можно установить с помощью «Параметров» Windows на устройствах Windows Server 2019 и Windows 10.

Чтобы установить компоненты OpenSSH, сделайте следующее:

Откройте приложение Параметры, выберите элементы Приложения > Приложения и возможности, щелкните Дополнительные возможности.

Просмотрите этот список и определите, установлено ли средство OpenSSH. Если нет, выберите пункт Добавить компонент в верхней части страницы и сделайте следующее:

После завершения установки вернитесь в раздел Приложения > Приложения и возможности и Дополнительные возможности, где теперь должно появиться средство OpenSSH.

Установка OpenSSH с помощью PowerShell

Чтобы установить OpenSSH с помощью PowerShell, запустите PowerShell от имени администратора. Для проверки доступности OpenSSH выполните следующий командлет:

Если ни один из них не установлен, должно отобразиться следующее:

Затем установите нужный серверный или клиентский компонент:

Оба командлета должны вернуть такие выходные данные:

Запуск и настройка OpenSSH Server

Чтобы запустить и настроить OpenSSH Server для первого использования, откройте PowerShell от имени администратора и выполните следующие команды для запуска sshd service :

Подключение к OpenSSH Server

После установки вы можете подключиться к серверу OpenSSH с устройства Windows 10 или Windows Server 2019, на котором установлен клиент OpenSSH, с помощью PowerShell, как показано ниже. Обязательно запустите PowerShell от имени администратора:

Когда подключение будет установлено, отобразится примерно следующее сообщение:

Если выбрать Да, этот сервер будет добавлен в список известных узлов SSH в клиенте Windows.

На этом этапе нужно ввести пароль. В целях безопасности пароль не будет отображаться по мере ввода.

После подключения вы увидите командную оболочку Windows:

Удаление OpenSSH с помощью приложения «Параметры» в Windows

Чтобы удалить OpenSSH с помощью приложения «Параметры» в Windows, сделайте следующее:

Удаление OpenSSH с помощью PowerShell

Чтобы удалить компоненты OpenSSH с помощью PowerShell, выполните следующие команды:

Если служба использовалась во время удаления, может потребоваться перезагрузка Windows.

How to install and configure OpenSSH on Windows

If you have a group of servers with Linux and Windows operating systems, then it is a good consideration to install and configure OpenSSH on Windows.

Because it would be easy to manage the servers using OpenSSH. Also, it encrypts traffic on both ends, eliminating security risks from hackers or eavesdroppers.

Moreover, we can use it for remote operations like file transfers and offers key-based password-less authentication.

Here at Bobcares, we have seen several such Windows-related errors as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to install and configure OpenSSH on Windows.

How to Install and Configure OpenSSH on Windows

Now let’s take a look at how our Support Engineers install OpenSSH on Windows Server.

1. Using Powershell as an Administrator User

2. Install OpenSSH client

Next, we install the OpenSSH client by executing the necessary commands. The client is the software that we use to connect to the OpenSSH server. Here, we will connect from our local laptop or workstation, so we begin by opening Powershell. In the Powershell prompt, we run the below command.

We can see a progress bar indicating the progress of the installation. Once the installation completes, we will receive the following output.

Step 3: Install the OpenSSH server

Now, we shall install the OpenSSH server. Here the server is the computer that runs in the sshd service. In the Powershell prompt, we execute the below command.

Again, here can see a progress bar indicating the progress of the installation. Once the installation completes, we can see the below output.

Uninstalling OpenSSH on Windows

In case, if we wish to remove the client or the server, then we run the below respective commands to remove them.

How to configure OpenSSH on Windows

After the installation of OpenSSH software, we can now configure it. Now, we shall set the sshd service to start on boot. This action will ensure to automatically restart the service if a reboot or power failure occurs. Here is the command that we execute in the Powershell prompt. This will start the service and set it to start automatically.

In order to allow a secure connection to our server, we need to add a firewall rule. This rule will allow inbound ssh traffic on port 22. To verify, we type this command at the Powershell prompt.

Now, we can see an enabled firewall rule named “OpenSSH-Server-In-TCP.” In the event we do not see a firewall rule, we will need to create one. For that, we run the following command.

Using OpenSSH

After having the OpenSSH server and client installed, we can now test the setup. now, we can check the connectivity from any Linux, Mac, or Windows device using an installed SSH Client. In Windows, we execute the following command in PowerShell.

NOTE: Replace the IP above with the IP address of your server

If connecting for the first time, then we will be asked to confirm the connection. We type “yes” and hit Enter.

Next, we enter the user password after it prompts for it.

After successful authentication of the user, we will be greeted with a command shell prompt.

The remote SSH session or “secure shell” is now live, and we can begin sending remote commands.

Transferring Files with OpenSSH after we install and configure it

Now let’s see how we can transfer files using OpenSSH. Here we are making use of the SCP file transfer utility provided by OpenSSH to transfer a file named “FileOnMyClient.txt” to the Administrator’s folder on our OpenSSH server.

From any Linux, Mac, or Windows device with the SSH Client installed, we can navigate to the folder our file is in by using the “cd” command.

NOTE: This assumes the file is in the Documents folder on the client.

In Powershell, we type the below command to transfer the file to the Administrators folder on the server:

Then we enter the password when prompted for and hit enter. We will see output similar to the following information indicating the transfer percentage, transfer speed and timeframe of the transfer.

[email protected]_address’s password:
bobtest.txt 100% 0 0.1KB/s 00:05

Next, in order to verify that the file is transferred successfully, we must go back to our server and type in the dir command again which lists all the files in that particular folder. As we can see, we have successfully transferred our text file.

We can also check the contents of our text file by using the built-in Windows command “type” command, followed by the name of the file.

Some common errors and fix relating to OpenSSH

Now let’s take a look at some of the common errors our customers came across and also let’s see how our Support Engineers fix them.

1. Add-WindowsCapability failed. Error code = 0x800f0950

If the build of the system is older than 17763.194, we will see this error. The installation of the OpenSSH server fails on earlier builds of Windows Server 2019.

From gpedit.msc (Group Policy), we select Computer Configuration >> Administrative Templates >> Windows Components >> Windows Update >> Specify intranet Microsoft update service location >> Finally, we set it to Disabled.

2. Error with “Add-WindowsCapability”. Error code: 0x8024002e

This error occurs if the server is updated via WSUS. Microsoft delivers features on-demand bypassing WSUS, so we do not get them via the internal update server.

In the event log, you will then find an entry with ID 1001 stating that the OpenSSH-Server-Package is not available.

Solution: Allow Windows to load optional features directly from Microsoft Update via group policy. This setting is “Specify settings for optional component installation and component repair,” and we can find it under Computer Configuration >> Policies >> Administrative Templates > System.

At the same time, ensure that neither the setting “Do not connect to Windows Update Internet locations” nor “Remove access to use all Windows Update features” is in effect.

[Still not able to install and configure OpenSSH on Windows? – We are here to help you]

Conclusion

Today, we saw how our Support Engineers install and configure OpenSSH on windows. Also, we saw some common errors relating to OpenSSH.

Related posts:

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

How to install the latest OpenSSH on Windows 7 and Windows 8

How to install openssh on windows 7. Смотреть фото How to install openssh on windows 7. Смотреть картинку How to install openssh on windows 7. Картинка про How to install openssh on windows 7. Фото How to install openssh on windows 7

For how to install OpenSSH on Windows 10, read How to install OpenSSH on Windows 10.

Occasionally I have to run an installation of Windows 7 or Windows 8 on one of my computers, which means having to copy files between it and the Linux computers on the network.

That’s when I realize how difficult it can be to use a default installation of Windows, especially from its command prompt (line), where I tend to spend most of my computing time.

For those times, I yearn for the versatility and simplicity of the Linux command line. Practically everything you need to use or manage a Linux system is installed out of the box. Just launch a shell terminal, type and go!

So early this morning I installed Windows 7 on a test machine and needed to copy files between it and a Linux computer on the network – from the command line. I had to look for a command-line SSH application to use for the task. One that does not require the installation of a complete Cygwin environment and is not an outdated and unmaintained package.

My search led me to the website of OpenSSH for Windows. And it is just what the doctor ordered. There I found 32- and 64-bit binaries of the latest and greatest version of OpenSSH for Windows. That means OpenSSH 6.7p1.

How to install openssh on windows 7. Смотреть фото How to install openssh on windows 7. Смотреть картинку How to install openssh on windows 7. Картинка про How to install openssh on windows 7. Фото How to install openssh on windows 7

A few minutes after I found the project’s website, I had the OpenSSH for Windows client and server installed and was copying files between an installation of Windows 7 and a Fedora 20 KDE computer – from the Windows 7 command prompt. Hope somebody else finds it useful.

How to configure OpenSSH on Windows 7

How to install openssh on windows 7. Смотреть фото How to install openssh on windows 7. Смотреть картинку How to install openssh on windows 7. Картинка про How to install openssh on windows 7. Фото How to install openssh on windows 7

I needed a simple ssh client for windows. Here’s what I did when installing OpenSSH, this worked for me, so hopefully will work for your install of ssh as well 🙂

Get OpenSSH for windows from sourceforge.net (http://sourceforge.net/projects/sshwindows/files/OpenSSH%20for%20Windows%20-%20Release/)

Run the installer, accept defaults of set the options to your liking.

Now SSH is installed but the problem is it set all options like it would on a Linux machine (the default). This won’t work on Windows. When you run ssh you will get something like this:

C:\Program Files\OpenSSH\bin>ssh someuser@someserver.com
Could not create directory ‘/home/SomeUser/.ssh’.
The authenticity of host ‘someserver.com (44.135.244.22)’ can’t be established.
RSA key fingerprint is 56:7b:96:50:57:7c:2d:12:21:1d:3c:b2:24:08:58:16.
Are you sure you want to continue connecting (yes/no)?

And if you enter ‘yes’ to the above question you will get something like:

Failed to add the host to the list of known hosts (/home/SomeUser/.ssh/known_hosts).

So as you can see OpenSSH is trying to create a “.ssh” directory in your user directory and then access a file named “known_hosts” in there. The problem is it is using the *NIX syntax for user directories “/home/USERNAME” and this of course won’t work on Windows.

How to fix this
First add a user for yourself. Run cmd.exe, do a “cd C:\Program Files\OpenSSH\bin” and then type :

Of course UserName should be your actual user name on windows.

Then open the file “C:\Program Files\OpenSSH\etc\passwd” in Notepad or any other text editor, it should have only 1 line of text in it – the config options related to your user. Scroll to the end of the line and change the Unix version of the home directory to (/home/USER) to your proper User directory i.e. change it to “\Users\UserName”, where UserName is again just placeholder for your real user name on your Windows machine.

Your ssh client should now be properly configured for Windows 😉

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *