Support for starting linux services in Windows Subsystem for Linux (WSL) on Windows startup.
- Use git clone to any directory (e.g
C:\wsl-autostart
)
git clone https://github.com/troytse/wsl-autostart
-
Add a string item under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
(e.gWSLAutostart
)
- Modify the
/etc/sudoers
file in WSL, Specified the service commands calling without password for the require auto starting. e.g:
%sudo ALL=NOPASSWD: /etc/init.d/cron
%sudo ALL=NOPASSWD: /etc/init.d/ssh
%sudo ALL=NOPASSWD: /etc/init.d/mysql
%sudo ALL=NOPASSWD: /etc/init.d/apache2
- Modify the
commands.txt
file to specify the service commands. e.g:
/etc/init.d/cron
/etc/init.d/ssh
/etc/init.d/mysql
/etc/init.d/apache2