Saturday, 2 March 2024

[Windoof] OpenSSH

Installation

As of Windows 10 the M$ OS has OpenSSH integrated as an optional feature - see also https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui#install-openssh-for-windows. To install it, you can try to find it in the optional features of the system area of the settings, where I miserably failed, or run the following PowerShell command as Administrator. The download process seems to very slow.

Get-WindowsCapability -Online | Where-Object Name -like ‘OpenSSH.Server*’ | Add-WindowsCapability –Online # install
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Ser*' # get status
Set-Service -Name sshd -StartupType 'Automatic' # make it run on boot
Start-Service sshd # start the service
Get-NetFirewallRule -Name *OpenSSH-Server* |select Name, DisplayName, Description, Enabled # open firewall for incoming connections
# if the rule is missing, run
# New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
 

Some installation paths:

Executables: C:\Windows\System32\OpenSSH\
Configuration:
C:\ProgramData\ssh
Personal files:
%USERPROFILE%\.ssh\

Some useful commands:

Restart-Service sshd # restart service, e.g. after changes of configuration

Connect to

 

ssh [<user_name>@]<host_name|fqn> # e.g. thiemo@hotrod.speedport.io

See also https://woshub.com/connect-to-windows-via-ssh/

[git] Create a local branch from another branch

From the active branch git checkout -b <LOCAL_BRANCH> From a donator branch git checkout -b <LOCAL_BRANCH> <DONATING_BRANCH...