Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Windows SSH client / Server
- # https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
- #
- # Check for installed
- Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
- #
- # Install the OpenSSH Client
- #Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
- # Install the OpenSSH Server
- Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
- # Both of these should return the following output:
- #Path :
- #Online : True
- #RestartNeeded : False
- # Uninstall the OpenSSH Client
- #Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
- # Uninstall the OpenSSH Server
- #Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
- Start-Service sshd
- # OPTIONAL but recommended:
- Set-Service -Name sshd -StartupType 'Automatic'
- # Confirm the Firewall rule is configured. It should be created automatically by setup.
- Get-NetFirewallRule -Name *ssh*
- # There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled
- # If the firewall does not exist, create one
- New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
- # sets the default shell to be PowerShell.exe
- New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
- #cd ~\.ssh\
- #ssh-keygen
- # Deprecated opensshutils, see below alternative
- # https://github.com/PowerShell/Win32-OpenSSH/wiki/Security-protection-of-various-files-in-Win32-OpenSSH
- # Key management https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement
- # Make sure that the .ssh directory exists in your server's home folder
- #ssh user1@domain1@contoso.com mkdir C:\users\user1\.ssh\
- # Use scp to copy the public key file generated previously to authorized_keys on your server
- #scp C:\Users\user1\.ssh\id_ed25519.pub user1@domain1@contoso.com:C:\Users\user1\.ssh\authorized_keys
- # Appropriately ACL the authorized_keys file on your server
- #ssh --% user1@domain1@contoso.com powershell -c $ConfirmPreference = 'None'; Repair-AuthorizedKeyPermission #C:\Users\user1\.ssh\authorized_keys
Add Comment
Please, Sign In to add comment