Windows Subsystem for Linux basics

User mountable network shares

Create entry in /etc/fstab:

 \\servername\sharename /mount/directory/name drvfs defaults,user 0 0


Run ssh-agent for the first opened shell:

## SSH-Agent handling
# get the latest created socket file, old ones are not removed automatically!
socket_file=$(ls -t $(find /tmp/ssh* -iname "agent.*") | head -1)

# get pid of a possibly running ssh-agent
agent_pid=$(pidof ssh-agent)

# if there is an agent running make the socket file known, start one otherwise
if [ ! -z "$agent_pid" ]; then
  export SSH_AUTH_SOCK=$socket_file
  eval $(ssh-agent)

Start cron daemon via Task Service

Allow non-root users to start the daemon via sudo:

sudo visudo # add the next line at the end of the file

%sudo ALL=NOPASSWD: /etc/init.d/cron start

Open the shell:startup location and create a shortcut to start cron after the Windows login:

C:\Windows\System32\wsl.exe sudo /etc/init.d/cron start

Attention: This invokes the distribution which is set as default. This can be changed by running wslconfig:

wslconfig /s Ubuntu-18.04