v9.8.3.0p2-Preview
v9.8.2.0p2-Preview
v9.8.1.0p1-Preview
This is a preview-release (non-production ready)
This release includes:
- fix for MSI, otherwise equivalent to the v9.8.0.0p1-Preview release.
v9.8.0.0p1-Preview
This is a preview-release (non-production ready)
Note that the change from «beta» to «preview» is simply to align with release naming requirements.
This release includes:
-
Upstream changes from OpenSSH 9.8p1.
-
Security Fixes (all pertaining to Windows parity with pre-existing upstream behavior):
- [ssh-agent] validate a PKCS11 library path based on allow-list configurable via
-P
, with default allow-list set to$env:ProgramFiles
and$env:ProgramFiles(x86)
— https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-38029. - [sftp] check for invalid character in filename to prevent recursive directory attack — https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43581.
- [scp] check for invalid character in filename to prevent recursive directory attack — https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43615.
- [ssh-agent] validate a PKCS11 library path based on allow-list configurable via
-
Non-Security Fixes:
- Upgrade to ZLib 1.3.1. Please refer to https://zlib.net/.
- Upgrade to LibreSSL 3.9.2. Please refer to https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.9.2-relnotes.txt.
- Upgrade to LibFido2 1.15.0. Please refer to https://developers.yubico.com/libfido2/Release_Notes.html.
v9.5.0.0p1-Beta
This is a beta-release (non-production ready)
This release includes:
-
Upstream changes from OpenSSH 9.5p1 and a cherry-pick of the «strict KEX» protocol extension changes from OpenSSH 9.6p1.
-
Breaking Changes:
- Remove sha1-based MACs from default configuration options in https://github.com/PowerShell/openssh-portable/pull/706/files.
-
Security Fixes:
- Service paths for SSHD and SSH-Agent in contrib\win32\openssh\install-sshd.ps1 are encapsulated in double-quotes.
-
Non-Security Fixes:
- [SCP/SFTP] Permit data upload that originates from a named pipe in PowerShell/openssh-portable#704.
- Upgrade to LibreSSL 3.8.2. Please refer to https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.8.2-relnotes.txt.
- Upgrade to LibFido2 1.14.0. Please refer to https://developers.yubico.com/libfido2/Release_Notes.html.
v9.4.0.0p1-Beta
This is a beta-release (non-production ready)
This release includes:
-
Upstream changes from OpenSSH 9.3p2 and OpenSSH 9.4.
-
Breaking changes — see upstream release notes for more information:
- the ssh-agent will now refuse requests to load PKCS#11 modules issued by remote clients by default. A flag has been added to restore the previous behavior «-Oallow-remote-pkcs11».
-
Security Fixes:
- the sshd service will check the
$env:ProgramData\ssh
folder permissions upon startup to ensure only SYSTEM and Administrator accounts have write access to the folder; similar to the existing check upon install incontrib\win32\openssh\install-sshd.ps1
.
- the sshd service will check the
-
Non-Security Fixes:
- Upgrade to LibreSSL 3.7.3. Please refer to https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.3-relnotes.txt
- Upgrade to ZLib 1.3. Please refer to http://zlib.net/
- Fix #2125 — thanks @samhocevar!
- Fix datatype mismatch — thanks @s911415!
v9.2.2.0p1-Beta
This is a beta-release (non-production ready)
This release includes:
-
Security Fixes:
- Upgrade to LibreSSL 3.7.2. Please refer to https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.2-relnotes.txt
- MSI: change inbound firewall rule that opens port 22 to apply to Private networks only
-
Non-Security Fixes:
- Add U2F/Fido2 keys to the agent from other clients: #1961 — thanks @ddrown!
- Fix output codepage after executing scp/sftp/ssh/ssh-keygen command: #2027 — thanks @kemaruya!
- Fix early EOF termination when running git fetch over ssh: #2012 — thanks @cwgreene!
- Revert mark-of-the-web for SCP/SFTP file downloads: #2029
v9.2.0.0p1-Beta
This is a beta-release (non-production ready)
This release includes:
-
Upstream changes from OpenSSH 9.2, which fixes a number of security bugs.
-
Breaking changes — see upstream release notes for more information:
- adds EnableEscapeCommandline to ssh_config, a new option, that controls whether the client-side ~C escape sequence that provides a command-line is available. EnableEscapeCommandline defaults to «no», which disables the ~C escape sequence that was previously enabled by default.
-
Security:
- The sftp server will not attempt to add the Mark-of-the-Web (MOTW) for files uploaded from sftp clients, which reverts the behavior added in 9.1. This is on par with scp behavior for file uploads. File download behavior via scp and sftp remains the same as 9.1, with a best effort attempt to add the MOTW. This change was prompted by Community feedback, as discussed in #2029.
-
Fixes for #2018 and #2019.
v9.1.0.0p1-Beta
This is a beta-release (non-production ready)
This release includes:
-
Upstream changes from OpenSSH 9.0 & OpenSSH 9.1.
-
Breaking changes — see upstream release notes for more information:
- Switches scp from using the legacy scp/rcp protocol to using the sftp protocol by default.
- SetEnv directives in ssh_config and sshd_config are now first-match-wins to match other directives. Previously if an environment variable was multiply specified the last set value would have been used.
- ssh-keygen -A (generate all default host key types) will no longer generate DSA keys.
-
Security Fixes:
- adds Mark of the Web (MOTW) to scp/sftp file transfers, when possible.
-
Fixes for various reliability issues listed here.
-
LibFido2 upgrade to version 1.12.0.
-
LibreSSL upgrade to version 3.6.1.
-
ZLib upgrade to version 1.2.13.
V8.9.1.0p1-Beta
This release includes
-
Security fixes
- Upgrade to LibreSSL 3.4.3. Please refer to #1917
-
Non-security fixes
- [FIDO] PIN is asked twice with keys generated with -O verify-required. #1918
- SSH-Agent installed through MSI is missing required privileges. #1914
- install-sshd.ps1 to allow silent installation #1916
Install using WinGet
Starting with GitHub Release 8.9.1.0, OpenSSH Beta releases are available through WinGet.
With WinGet installed on the machine, use the following commands:
- Search:
winget search "openssh beta"
- Install:
winget install "openssh beta"
- Uninstall:
winget uninstall "openssh beta"
note: to install/uninstall only the OpenSSH client or OpenSSH server, see https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH-Using-MSI for args that can be passed to winget via --override
(https://learn.microsoft.com/en-us/windows/package-manager/winget/install).
Install Win32 OpenSSH (test release)
-
Win32-OpenSSH Github releases can be installed on Windows 7 and up.
-
Note these considerations and project scope first.
-
Download the latest build of OpenSSH.
To get links to latest downloads this wiki page. -
Extract contents of the latest build to
C:\Program Files\OpenSSH
(Make sure binary location has the Write permissions to just to SYSTEM, Administrator groups. Authenticated users should and only have Read and Execute.) -
In an elevated Powershell console, run the following
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
-
Open the firewall for sshd.exe to allow inbound SSH connections
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Note:
New-NetFirewallRule
is for Windows 2012 and above servers only. If you’re on a client desktop machine (like Windows 10) or Windows 2008 R2 and below, try:netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22
-
Start
sshd
(this will automatically generate host keys under %programdata%\ssh if they don’t already exist)net start sshd
-
Optional
- To configure a default shell, see here
- To setup
sshd
service to auto-startSet-Service sshd -StartupType Automatic
- To migrate sshd configuration from older versions (0.0.X.X), see here
Uninstall Win32 OpenSSH
- Start Windows Powershell as Administrator
- Navigate to the OpenSSH directory
cd 'C:\Program Files\OpenSSH'
- Run the uninstall script
powershell.exe -ExecutionPolicy Bypass -File uninstall-sshd.ps1
Exported on 19-Nov-2021 13:16:05
Name | Type | Script Reference | Default Value | Comment | |
---|---|---|---|---|---|
OpenSSH Archive Download Filename | Text | opensshArchiveDownloadFilename | OpenSSH-Win64.zip | The name of the archive when downloaded to $env:TMP. | |
OpenSSH Archive Download URL | Text | opensshArchiveDownloadUrl | https://github.com/PowerShell/Win32-OpenSSH/releases/download/V8.6.0.0p1-Beta/OpenSSH-Win64.zip | The release archive download link. | |
Windows Node | Windows Server | windowsNode | |||
Windows User | Windows OS Credential | windowsUser |
This step has the following parameters
Name | Script Reference | Default Value |
---|---|---|
OpenSSH Archive Download URL | {opensshArchiveDownloadUrl} | https://github.com/PowerShell/Win32-OpenSSH/releases/download/V8.6.0.0p1-Beta/OpenSSH-Win64.zip |
OpenSSH Archive Download Filename | {opensshArchiveDownloadFilename} | OpenSSH-Win64.zip |
The connection details have changed from the last step.
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# Download OpenSSH release archive from Microsoft PowerShell github repo
$Destination = ($env:TMP + "\{opensshArchiveDownloadFilename}")
Invoke-RestMethod -Uri {opensshArchiveDownloadUrl} -OutFile $Destination
This step has the following parameters
Name | Script Reference | Default Value |
---|---|---|
OpenSSH Archive Download Filename | {opensshArchiveDownloadFilename} | OpenSSH-Win64.zip |
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# Unzip the file from the downloaded repo to Program Files dir
$ArchivePath = ($env:TMP + "\{opensshArchiveDownloadFilename}")
Expand-Archive -Path $ArchivePath -DestinationPath ($env:ProgramFiles)
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
Rename-Item ($env:ProgramFiles + "\OpenSSH-Win64") ($env:ProgramFiles + "\OpenSSH")
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# Install OpenSSH
. ($env:ProgramFiles + "\OpenSSH\install-sshd.ps1")
This step has the following parameters
Name | Script Reference | Default Value |
---|---|---|
OpenSSH Archive Download Filename | {opensshArchiveDownloadFilename} | OpenSSH-Win64.zip |
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# Remove the Downloaded OpenSSH file
$ArchivePath = ($env:TMP + "\{opensshArchiveDownloadFilename}")
Remove-Item -Path $ArchivePath -Force
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# make the service automatically start when Windows booting up
Set-Service -Name sshd -StartupType Automatic
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# Start the sshd service
Start-Service sshd
Login as user
{Windows User}
on node
{Windows Node}
- Connect via RDP
mstsc /admin /v:Windows Node
- Login as user {Windows User}
- Then open a command prompt
This is a
PowerShell Script
make sure you run it with
powershell.exe
Click start menu, enter «powershell» in the search bar, then select the powersehll program
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
Установка
Для работы с удаленными папками на windows сервере по ssh из VSCode плагином Remote-SSH на стороне windows сервера требуется служба ssh-сервера. Давайте его установим.
- Скачиваем последнюю версию дистрибутива OpenSSH
Сейчас доступна версия v8.0.0.0p1-Beta. Скачиваем OpenSSH-Win64.zip
.
- Создаем каталог C:\Program Files\OpenSSH и распаковываем в неё содержимое архива.
- Запускаем powershell от имени администратора.
- Выполняем скрипт установки:
cd "\Program Files\OpenSSH"
.\install-sshd.ps1
sshd and ssh-agent services successfully installed
Если произошла ошибка политики безопасности, то можно выполнить установку так:
powershell -ExecutionPolicy Bypass -File .\install-sshd.ps1
- Генерируем серверные ключи:
Если при этом появляется ошибка
Нужно в папке C:\ProgramData
создать вручную директорию ssh
- Снова пытаемся сгенерировать серверные ключи:
На этот раз процедура выполняется успешно.
- Настраиваем владельца и права доступа на файлы ключей и каталоги сервера :
PowerShell -ExecutionPolicy Bypass -File .\FixHostFilePermissions.ps1
На каждый вопрос отвечаем “A”.
- Открываем 22 порт
OpenSSH работает по порту TCP 22. Откроем доступ в Firewall:
New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH
Эта команда сработает на Windows Server 12 и моложе. На более старых серверах порт можно открыть через GUI в оснастке Windows Firewall with Advanced Security
.
- Запуск службы OpenSSH
Открываем список служб:
Находим службу “OpenSSH SSH Server”. В свойствах службы устанавливаем автоматический запуск и запускаем её.
Проверим что 22 порт работает:
22 порт слушается.
- Проверка OpenSSH
Проверим с помощью WinSCP. Для доменного пользователя используется логин вида domain\username.
При первом входе появится окно:
Yes.
Установка завершена.
в тексте 356 слов
В современных версиях Windows уже есть встроенный SSH сервер на базе пакета OpenSSH. В этой статье мы покажем, как установить и настроить OpenSSH сервер в Windows 10/11 и Windows Server 2022/2019 и подключиться к нему удаленно по защищенному SSH протоколу (как к Linux).
Содержание:
- Установка сервера OpenSSH в Windows
- Настройка SSH сервера в Windows
- Sshd_config: Конфигурационный файл сервера OpenSSH
- Подключение по SSH к Windows компьютеру
- Логи SSH подключений в Windows
Установка сервера OpenSSH в Windows
Пакет OpenSSH Server включен в современные версии Windows 10 (начиная с 1803), Windows 11 и Windows Server 2022/2019 в виде Feature on Demand (FoD). Для установки сервера OpenSSH достаточно выполнить PowerShell команду:
Get-WindowsCapability -Online | Where-Object Name -like ‘OpenSSH.Server*’ | Add-WindowsCapability –Online
Или при помощи команды DISM:
dism /Online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0
Если ваш компьютер подключен к интернету, пакет OpenSSH.Server будет скачан и установлен в Windows.
Также вы можете установить сервер OpenSSH в Windows через современную панель Параметры (Settings -> Apps and features -> Optional features -> Add a feature, Приложения -> Управление дополнительными компонентами -> Добавить компонент. Найдите в списке OpenSSH Server и нажмите кнопку Install).
На изолированных от интернета компьютерах вы можете установить компонент с ISO образа Features On Demand (доступен в личном кабинете на сайте Microsoft: MSDN или my.visualstudio.com). Скачайте диск, извлеките его содержимое в папку c:\FOD (достаточно распаковать извлечь файл
OpenSSH-Server-Package~31bf3856ad364e35~amd64~~.cab
), выполните установку из локального репозитория:
Add-WindowsCapability -Name OpenSSH.Server~~~~0.0.1.0 -Online -Source c:\FOD
Также доступен MSI установщик OpenSSH для Windows в официальном репозитории Microsoft на GitHub (https://github.com/PowerShell/Win32-OpenSSH/releases/). Например, для Windows 10 x64 нужно скачать и установить пакет OpenSSH-Win64-v8.9.1.0.msi. Следующая PowerShell команда скачает MSI файл и установит клиент и сервер OpenSSH:
Invoke-WebRequest https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.9.1.0p1-Beta/OpenSSH-Win64-v8.9.1.0.msi -OutFile $HOME\Downloads\OpenSSH-Win64-v8.9.1.0.msi -UseBasicParsing
msiexec /i c:\users\root\downloads\OpenSSH-Win64-v8.9.1.0.msi
Также вы можете вручную установить OpenSSH сервер в предыдущих версиях Windows (Windows 8.1, Windows Server 2016/2012R2). Пример установки Win32-OpenSSH есть в статье “Настройка SFTP сервера (SSH FTP) в Windows”.
Чтобы проверить, что OpenSSH сервер установлен, выполните:
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Ser*'
State : Installed
Настройка SSH сервера в Windows
После установки сервера OpenSSH в Windows добавляются две службы:
- ssh-agent (OpenSSH Authentication Agent) – можно использовать для управления закрытыми ключами если вы настроили SSH аутентификацию по ключам;
- sshd (OpenSSH SSH Server) – собственно сам SSH сервер.
Вам нужно изменить тип запуска службы sshd на автоматический и запустить службу с помощью PowerShell:
Set-Service -Name sshd -StartupType 'Automatic'
Start-Service sshd
С помощью nestat убедитесь, что теперь в системе запущен SSH сервер и ждет подключений на порту TCP:22 :
netstat -na| find ":22"
Проверьте, что включено правило брандмауэра (Windows Defender Firewall), разрешающее входящие подключения к Windows по порту TCP/22.
Get-NetFirewallRule -Name *OpenSSH-Server* |select Name, DisplayName, Description, Enabled
Name DisplayName Description Enabled ---- ----------- ----------- ------- OpenSSH-Server-In-TCP OpenSSH SSH Server (sshd) Inbound rule for OpenSSH SSH Server (sshd) True
Если правило отключено (состоянии Enabled=False) или отсутствует, вы можете создать новое входящее правило командой New-NetFirewallRule:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Рассмотрим, где храниться основные компоненты OpenSSH:
- Исполняемые файлы OpenSSH Server находятся в каталоге
C:\Windows\System32\OpenSSH\
(sshd.exe, ssh.exe, ssh-keygen.exe, sftp.exe и т.д.) - Конфигурационный файл sshd_config (создается после первого запуска службы):
C:\ProgramData\ssh
- Файлы authorized_keys и ssh ключи можно хранить в профиле пользователей:
%USERPROFILE%\.ssh\
Sshd_config: Конфигурационный файл сервера OpenSSH
Настройки сервере OpenSSH хранятся в конфигурационном файле %programdata%\ssh\sshd_config. Это обычный текстовый файл с набором директив. Для редактирования можно использовать любой текстовый редактор (я предпочитаю notepad++). Можно открыть с помощью обычного блокнота:
start-process notepad C:\Programdata\ssh\sshd_config
Например, чтобы запретить SSH подключение для определенного доменного пользователя (и всех пользователей указанного домена), добавьте в конце файле директивы:
DenyUsers winitpro\[email protected] DenyUsers corp\*
Чтобы разрешить подключение только для определенной доменной группы:
AllowGroups winitpro\sshadmins
Либо можете разрешить доступ для локальной группы:
AllowGroups sshadmins
По умолчанию могут к openssh могут подключаться все пользователи Windows. Директивы обрабатываются в следующем порядке: DenyUsers, AllowUsers, DenyGroups,AllowGroups.
Можно запретить вход под учетными записями с правами администратора, в этом случае для выполнения привилегированных действий в SSH сессии нужно делать runas.
DenyGroups Administrators
Следующие директивы разрешают SSH доступ по ключам (SSH аутентификации в Windows с помощью ключей описана в отдельной статье) и по паролю:
PubkeyAuthentication yes PasswordAuthentication yes
Вы можете изменить стандартный SSH порт TCP/22, на котором принимает подключения OpenSSH в конфигурационном файле sshd_config в директиве Port.
После любых изменений в конфигурационном файле sshd_config нужно перезапускать службу sshd:
restart-service sshd
Подключение по SSH к Windows компьютеру
Теперь вы можете попробовать подключиться к своей Windows 10 через SSH клиент (в этом примере я использую putty).
Вы можете использовать встроенный SSH клиентом Windows для подключения к удаленному хосту. Для этого нужно в командной строке выполнить команду:
ssh [email protected]
В этом примере
alexbel
– имя пользователя на удаленном Windows компьютере, и 192.168.31.102 – IP адрес или DNS имя компьютера.
Обратите внимание что можно использовать следующие форматы имен пользователей Windows при подключении через SSH:
-
alex@server1
– локальный пользователь Windows -
[email protected]@server1
–пользователь Active Directory (в виде UPN) или аккаунт Microsoft/ Azure(Microsoft 365) -
winitpro\alex@server1
– NetBIOS формат имени
В домене Active Directory можно использовать Kerberos аутентификацию в SSH. Для этого в sshd_config нужно включить параметр:
GSSAPIAuthentication yes
После этого можно прозрачно подключать к SSH сервер с Windows компьютера в домене из сессии доменного подключается. В этом случае пароль пользователя не указывается и выполняется SSO аутентификация через Kerberos:
ssh -K server1
При первом подключении появится стандартный запрос на добавление узла в список известных SSH хостов.
Нажимаем Да, и в открывшееся окне авторизуемся под пользователем Windows.
При успешном подключении запускается командная оболочка cmd.exe со строкой-приглашением.
admin@win10tst C:\Users\admin>
В командной строке вы можете выполнять различные команды, запускать скрипты и программы.
Я предпочитаю работать в командной строке PowerShell. Чтобы запустить интерпретатор PowerShell, выполните:
powershell.exe
Чтобы изменить командную оболочку (Shell) по умолчанию в OpenSSH с cmd.exe на PowerShell, внесите изменение в реестр такой командой:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String –Force
Осталось перезапустить SSH подключение и убедиться, что при подключении используется командный интерпретатор PowerShell (об этом свидетельствует приглашение
PS C:\Users\admin>
).
В SSH сессии запустилась командная строка PowerShell, в которой работают привычные функции: авто дополнение, раскраска модулем PSReadLine, история команд и т.д. Если текущий пользователь входит в группу локальных администраторов, то все команды в его сессии выполняются с повышенными правами даже при включенном UAC.
Логи SSH подключений в Windows
В Windows логи подключений к SSH серверу по-умолчанию пишутся не в текстовые файлы, а в отдельный журнал событий через Event Tracing for Windows (ETW). Откройте консоль Event Viewer (
eventvwr.msc
>) и перейдите в раздел Application and services logs -> OpenSSH -> Operational.
При успешном подключении с помощью к SSH серверу с помощью пароля в журнале появится событие:
EventID: 4 sshd: Accepted password for root from 192.168.31.53 port 65479 ssh2
Если была выполнена аутентификация с помощью SSH ключа, событие будет выглядеть так:
sshd: Accepted publickey for locadm from 192.168.31.53 port 55772 ssh2: ED25519 SHA256:FEHDEC/J72Fb2zC2oJNb45678967kghH43h3bBl31ldPs
Если вы хотите, чтобы логи писались в локальный текстовый файл, нужно в файле sshd_config включить параметры:
SyslogFacility LOCAL0 LogLevel INFO
Перезапустите службу sshd и провеьте, что теперь логи SSH сервера пишутся в файл C:\ProgramData\ssh\logs\sshd.log