Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Create non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe committed Sep 12, 2023
1 parent f898758 commit fa0597a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Use the `bin/start-vm` script from [Garden Linux](https://github.com/gardenlinux
Depending on your architecture, it should look like this:

```bash
$ path/to/gardenlinux/bin/start-vm --no-watchdog .build/ostree-arm64-trixie-local.ostree.raw
$ path/to/gardenlinux/bin/start-vm --no-watchdog .build/ostree-arm64-trixie*.ostree.raw
```

```bash
$ path/to/gardenlinux/bin/start-vm --no-watchdog .build/ostree-amd64-trixie-local.ostree.raw
$ path/to/gardenlinux/bin/start-vm --no-watchdog .build/ostree-amd64-trixie*.ostree.raw
```

Check for the actual name of the image in the `.build` directory.
5 changes: 5 additions & 0 deletions features/ostree/exec.late
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ cp "/boot/initrd.img-$version" /usr/lib/modules/$version/initramfs.img
# Build fails if we do this here instead of in image.ostree.raw
# mv /etc /usr/etc

useradd --user-group --home-dir /var/home/user --shell /usr/bin/bash user
printf "user:user123!" | chpasswd
echo "%sudo ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/nopasswd
usermod -aG sudo user

# Delete apt because this is an image-based system
rm -f /etc/cron.daily/apt-compat
rm -f /etc/logrotate.d/apt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root -o '-p -f -- \\u' --keep-baud 115200,38400,9600 %I $TERM
ExecStart=-/sbin/agetty --autologin user -o '-p -f -- \\u' --keep-baud 115200,38400,9600 %I $TERM
3 changes: 3 additions & 0 deletions features/ostree/image.ostree.raw
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ boot_hash=`ls "$OSTREE_SYSROOT"/ostree/boot.1.1/gardenlinux/`
mkdir -p "$OSTREE_SYSROOT"/ostree/boot.1.1/gardenlinux/$boot_hash/0/sysroot

mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/home
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/home/user
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/roothome
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/opt
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/srv

chown 1000:1000 "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/home/user

# Build disk image, this is hacky as of now, needs rework
# Setup bootloader
boot_dir=$(mktemp -d)
Expand Down
1 change: 1 addition & 0 deletions features/ostree/pkg.include
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ network-manager
ostree
ostree-boot
podman
sudo
systemd
systemd-boot
systemd-resolved

0 comments on commit fa0597a

Please sign in to comment.