Skip to content

Instantly share code, notes, and snippets.

@andrewfinnell
Last active September 24, 2020 14:44
Show Gist options
  • Save andrewfinnell/ce3f3ba9da7e0001f3117dd1443328be to your computer and use it in GitHub Desktop.
Save andrewfinnell/ce3f3ba9da7e0001f3117dd1443328be to your computer and use it in GitHub Desktop.
WSL SSH Server

Installation

Install SSHD

sudo apt install openssh-server

Configure SSH Server

sudo vi /etc/ssh/sshd_config

Enable Password Authentication and Specific Users

#PasswordAuthentication yes
# -- end of file 
#AllowUsers afinnell

Allow SSHD to run without sudo passsword

sudo vi /etc/sudoers

Edit:

# after $sudo ALL=(ALL:ALL) ALL
#%sudo ALL=NOPASSWD: /usr/sbin/sshd

Start Server to check config

sudo service ssh start
# or full restart
sudo service ssh --full-restart

Start Server Upon Login

  • Task Scheduler
  • New Basic Task
  • Trigger: On User Logon
  • Program: %windir%\System32\bash.exe
  • Arguments: -c "/etc/init.d/ssh start

Enable GIT Remote Server

Create git user

sudo adduser --create-home -s /bin/bash git
sudo su - git
cd
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment