Improve WSL Security with Read-Only Filesystem

Posted on Wed 04 October 2023 in linux • Tagged with wsl windows linux

By default, all Windows drives are mounted with read & write access (rw) within WSL . Though this is convenient for beginners, it opens up VM shell attacks on your Windows host files.

Instead, we can disable the auto mount feature using wsl.conf and selectively add read-only drives inside the WSL VM using /etc/fstab

Overview

  1. Deactivate "auto mount" in /etc/wsl.conf
  2. Enable fstab using MOUNTfStAB = true in wsl.conf
  3. test config files and mounting work well
  4. reboot the wsl VM to complete the setup

Example WSL Config wsl.conf

Place this inside the /etc/ directory on the WSL VM …

Continue reading

A Timeless Directory Layout for All of your Projects

Posted on Sun 31 May 2020 in linux • Tagged with business

Directory layouts are like log cabins that start from a basic shed, gradually adding a room at a time. When you start out on UNIX, everything gets thrown in your home directory. Over time you start to develop a structure for your sources, binaries, projects, data files (like CSV, images, tar files), config, etc

My layout is called TDL -- because it allows me to juggle open source projects, partnerships and jobs in a consistent structure across machines and time.

:::bash
~/
│── .cfg          # bare git repo with my dotfiles
│── local         # e.g. make install --prefix=~/local     - lib, bin, man  
│── .trash        # files to …
Continue reading