WINDOWS SSHD Installation: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „=Checken ob SSH installiert ist= *Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*' <pre> Name : OpenSSH.Client~~~~0.0.1.0 State : NotPresent…“)
 
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 9: Zeile 9:
 
</pre>
 
</pre>
 
=Installation des OpenSSH Server=
 
=Installation des OpenSSH Server=
*Add-WindowsCapability -Online -Name OpenSSH.Server[[Benutzer:Thomas.will|Thomas.will]] ([[Benutzer Diskussion:Thomas.will|Diskussion]]) 10:11, 17. Nov. 2021 (UTC)0.0.1.0
+
*Add-WindowsCapability -Online -Name OpenSSH.Server
 
  Path          :
 
  Path          :
 
  Online        : True
 
  Online        : True
 
  RestartNeeded : False
 
  RestartNeeded : False
 +
 
=Starten des sshd service=
 
=Starten des sshd service=
 
*Start-Service sshd
 
*Start-Service sshd
Zeile 26: Zeile 27:
 
}
 
}
 
</pre>
 
</pre>
 +
=SSH Anpassungen=
 +
*cat C:\ProgramData\ssh\sshd_config
 +
PubkeyAuthentication yes
 +
Subsystem powershell c:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo
 +
=SSH restart=
 +
*Restart-Service sshd
 +
=Einlogen von Remote=
 +
*ssh thomas.will@tomwin powershell
 +
=Administrator Key=
 +
;Hier müssen die Adminkeys rein
 +
*C:\ProgramData\ssh\administrators_authorized_keys
 +
 +
=Links=
 +
*https://docs.microsoft.com/de-de/windows-server/administration/openssh/openssh_install_firstuse

Aktuelle Version vom 4. November 2023, 10:35 Uhr

Checken ob SSH installiert ist

  • Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
Name  : OpenSSH.Client~~~~0.0.1.0
State : NotPresent

Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

Installation des OpenSSH Server

  • Add-WindowsCapability -Online -Name OpenSSH.Server
Path          :
Online        : True
RestartNeeded : False

Starten des sshd service

  • Start-Service sshd

Automatisches Starten des sshd service

  • Set-Service -Name sshd -StartupType 'Automatic'

Firewall anpassen

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."
}

SSH Anpassungen

  • cat C:\ProgramData\ssh\sshd_config
PubkeyAuthentication yes
Subsystem powershell c:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo

SSH restart

  • Restart-Service sshd

Einlogen von Remote

  • ssh thomas.will@tomwin powershell

Administrator Key

Hier müssen die Adminkeys rein
  • C:\ProgramData\ssh\administrators_authorized_keys

Links