This guide explains how to copy a Linux image onto a USB key from a Windows or Linux system.

PiGuard USB

Prerequisites

1. Creating a Bootable USB flash drive for Windows

To copy the ISO image onto the USB stick under Windows, we will use Rufus:

  1. Download and install Rufus
    Go to the official Rufus website and download the latest version.
  2. Plug in the USB flash drive
    Insert the USB flash drive into your computer. Make sure it does not contain any important data, as it will be erased.
  3. Launch Rufus
    Open Rufus and select your USB flash drive from the list of devices.
  4. Select the ISO image
    Click Select and choose the ISO image you downloaded.
  5. Configuration options
    1. Select the partition scheme to MBR (BIOS or UEFI compatible).
    2. Click Start to create the bootable USB flash drive.
  6. Wait for the process to finish
    Once complete, the USB flash drive is ready to be used to boot into a computer.

1.1. Creating a bootable USB flash drive under Linux

To copy the ISO image to the USB stick under Linux, use the dd command:

  1. Plug in the USB flash drive
    Insert the USB flash drive into your computer and identify its device name (for example /dev/sdb). You can use the lsblk command to check.
  2. Copy the ISO image
    • Use the following command to copy the ISO image onto the USB stick:sudo dd if=/path/to/your_image.iso of=/dev/sdX bs=4M status=progress && sync
    • Replace /path/to/your_image.iso with the path to your ISO file and /dev/sdX with the correct name of your USB key (for example /dev/sdb). Warning: This command deletes all the data on the USB key.
  3. Wait for the process to finish
    Once complete, the USB flash drive is ready to use.

2. Modify the WireGuard Configuration File (wg0.conf)

Now that the USB key is bootable with Linux, you need to configure WireGuard by modifying the wg0.conf file to add your own VPN account.

  1. Boot on the USB flash drive
    • Insert the USB flash drive into the target computer, reboot it, and access the boot menu (often via F12, Esc, or another key depending on the manufacturer).
    • Select the USB key as the boot device.
  2. Mount the USB Flash Drive Partition (if necessary):
    • Log in with the user piguard (ask ofr the apsword to Nothing2Hide)
    • The wg0.conf file is located in the /etc/wireguard/ directory on the USB flash drive.
    • If the partition is not already mounted, you can mount it with the following command:sudo mount /dev/sdX1 /mnt

This step can be performed under Windows or Linux by plugging in the USB flash drive without rebooting and editing the file directly. On Windows, you will need to install third-party software to write to ext4.

  1. Save and Exit
    To save changes in nano, use Ctrl+O, then Enter, and exit with Ctrl+X.
  2. Start WireGuard or reboot the computer
    Use the following command to start WireGuard:sudo wg-quick up wg0

Useful configuration files path

Conclusion

You now have a bootable USB stick with a minimalist Linux configured to work as a Wi-Fi access point, while encapsulating traffic in a WireGuard VPN. Make sure you follow these steps every time you want to update your WireGuard configuration.

SSID: SecureTunnel

Pass: StrongPass!33