Skip to content

Instantly share code, notes, and snippets.

@wallace11
Last active November 16, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wallace11/aeb15cf40faad3c4afa2e9a64ee1f64c to your computer and use it in GitHub Desktop.
Save wallace11/aeb15cf40faad3c4afa2e9a64ee1f64c to your computer and use it in GitHub Desktop.
  1. sudo apt-get remove openssh-server && sudo apt-get install openssh-server

  2. /etc/ssh/sshd_config:

    Change - PermitRootLogin no
    Add - AllowUsers yourusername
    Change - PasswordAuthentication yes
    Add - UsePrivilegeSeparation no
    Change - ListenAddress 0.0.0.0
    Change - Port 2200
    
  3. sudo service ssh --full-restart

Source

  1. Install SSH Server:

    dism /online /Add-Capability /CapabilityName:OpenSSH.Server~~~~0.0.1.0

  2. Generate SSH Key:

    cd c:\windows\system32\OpenSSH
    ssh-keygen -A
    
  3. Add user policy to run scripts:

    Set-ExecutionPolicy -ExecutionPolicy AllSigned

  4. Fix Permissions:

    Install-Module -Force OpenSSHUtils
    Repair-SshdHostKeyPermission -FilePath     C:\Windows\System32\OpenSSH\ssh_host_ed25519_key
    
  5. Start service:

    sc start sshd

Disable Windows Update

net stop wuauserv
net stop bits

Shrink WinSxs:

Dism.exe /online /Cleanup-Image /AnalyzeComponentStore
  • Uninstall all previous versions of components

    Dism.exe /online /Cleanup-Image /StartComponentCleanup

  • Remove service packs uninstallation files

    Dism.exe /online /Cleanup-Image /SPSuperseded

  • Remove all old versions of EVERY component

    Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

  • Use Compact OS:

    Compact.exe /CompactOS:query

    Compact.exe /CompactOS:always

  • Reduce Hibernation:

    powercfg /h /type reduced

    powercfg /h /off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment