Updated some naming schemes in alpine server and desktop sections.

This commit is contained in:
Luc Bijl 2024-07-08 12:56:43 +02:00
parent 2306ec2b73
commit c14a99086a
8 changed files with 35 additions and 31 deletions

View file

@ -2,6 +2,8 @@
It might be nice to add a user to your system. It might be nice to add a user to your system.
## Doas ## Doas
Before creating the user install `doas` for when root is requiered: Before creating the user install `doas` for when root is requiered:
@ -24,16 +26,18 @@ And create a `_power` group for user's to be able to poweroff the system without
# addgroup -S _power # addgroup -S _power
``` ```
## Adding a user ## Adding a user
Adding a user in alpine can be done using the `setup-user` script. Here we can specify the name, fullname, groups and more: Adding a user in alpine can be done using the `setup-user` script. Here we can specify the name, fullname with `-f`, groups and more:
``` ```
# setup-user -g wheel,nix,_power -f "<Full Name>" <username> # setup-user -g wheel,_power -f "<Full Name>" <username>
# passwd <username> # passwd <username>
``` ```
> It's also recommended to have an "admin" account which is the only one in the wheel group. > It is also recommended to have an "admin" account which is the only one in the wheel group.
And you may have to change the shell of the user in `/etc/passwd` from `/sbin/nologin` to a shell from `/etc/shells`. Alpine Linux comes with `/bin/ash` by default: And you may have to change the shell of the user in `/etc/passwd` from `/sbin/nologin` to a shell from `/etc/shells`. Alpine Linux comes with `/bin/ash` by default:
@ -55,12 +59,16 @@ And editing `/etc/passwd` to change the login shell from `/bin/ash` to `/sbin/no
root:x:0:0:root:/root:/sbin/nologin root:x:0:0:root:/root:/sbin/nologin
``` ```
### Encrypting the home directory (Not yet working, DO NOT FOLLOW) ### Encrypting the home directory (Not yet working, DO NOT FOLLOW)
If you are running a system with multiple users or if you want an extra layer of protection then it's possible to encrypt every user's home directory. If you are running a system with multiple users or if you want an extra layer of protection then it's possible to encrypt every user's home directory.
> Do note that a second layer of encryption can lead to lower disk performance so in the case where this is important it might be preferred not to encrypt. > Do note that a second layer of encryption can lead to lower disk performance so in the case where this is important it might be preferred not to encrypt.
#### Setting up fscrypt #### Setting up fscrypt
First install the `fscrypt` and `e2fsprogs-extra` packages: First install the `fscrypt` and `e2fsprogs-extra` packages:
@ -85,6 +93,8 @@ auth optional pam_fscrypt.so
session optional pam_fscrypt.so session optional pam_fscrypt.so
``` ```
#### Encrypting a user's home #### Encrypting a user's home
Encrypt the directory with: Encrypt the directory with:
@ -101,6 +111,8 @@ Then reboot and login with the user to check if it worked. It should also have g
$ fscrypt status /home/<username> $ fscrypt status /home/<username>
``` ```
## TLDR ## TLDR
If you have already set up a system with a user but want to add another do this: If you have already set up a system with a user but want to add another do this:

View file

@ -1,6 +1,6 @@
# Installation # Installation
To install the Alpine Linux distribution on the system, the main partition and the efi partition have to be mounted to the main system. To install the Alpine Linux distribution on the system, the root subvolume and the efi partition have to be mounted to the main system.
``` ```
# mount -o subvol=@root /dev/mapper/luks /mnt -t btrfs # mount -o subvol=@root /dev/mapper/luks /mnt -t btrfs
@ -14,7 +14,7 @@ Then set up the base system using `setup disk`:
# setup-disk -m sys /mnt # setup-disk -m sys /mnt
``` ```
This will also add grub as bootloader which will be replaced but for now it will reside on the boot partition. This will also add grub as bootloader which will be replaced but for now it will reside on the efi partition.
To make it possible to chroot into the system, mount the other directories: To make it possible to chroot into the system, mount the other directories:
@ -60,7 +60,7 @@ tmpfs /tmp tmpfs rw,size=4G,nr_inodes=5k,n
proc /proc proc nosuid,nodev,noexec,hidepid=2 0 0 proc /proc proc nosuid,nodev,noexec,hidepid=2 0 0
``` ```
Here `<volume-uuid>` has to be replaced with the uuid of the main volume: Here `<volume-uuid>` has to be replaced with the uuid of the root volume:
``` ```
# blkid /dev/mapper/luks >> /etc/fstab # blkid /dev/mapper/luks >> /etc/fstab
@ -105,7 +105,7 @@ output_dir="/efi/EFI/Linux"
output_name="alpine-linux-{flavor}.efi" output_name="alpine-linux-{flavor}.efi"
``` ```
Here `<partition-uuid>` and `<volume-uuid>` have to be replaced with the uuid of the main partition and volume respectively. Here `<partition-uuid>` and `<volume-uuid>` have to be replaced with the uuid of the root partition and volume respectively.
``` ```
# blkid /dev/<disk>2 >> /etc/kernel-hooks.d/secureboot.conf # blkid /dev/<disk>2 >> /etc/kernel-hooks.d/secureboot.conf

View file

@ -28,7 +28,7 @@ Then to create the filesystem on the efi partition.
# mkfs.fat -F 32 -n efi /dev/<disk>1 # mkfs.fat -F 32 -n efi /dev/<disk>1
``` ```
The main partition of the system is going to be encrypted using `cryptsetup`. First generate a key that will be used to encrypt the device and save it temporarily to the file `/tmp/crypt-key.txt` with: The root partition of the system is going to be encrypted using `cryptsetup`. First generate a key that will be used to encrypt the device and save it temporarily to the file `/tmp/crypt-key.txt` with:
``` ```
# cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1 > /tmp/crypt-key.txt && cat /tmp/crypt-key.txt # cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1 > /tmp/crypt-key.txt && cat /tmp/crypt-key.txt
@ -44,21 +44,21 @@ Then format the partition using `cryptsetup`:
# cryptsetup open --type luks /dev/<disk>2 luks # cryptsetup open --type luks /dev/<disk>2 luks
``` ```
Now to create a btrfs filesystem on the main partition use: This creates a formatted partition on `\dev\mapper\luks` which is denoted as the root volume. A btrfs filesystem will be created on the root volume by:
``` ```
# mkfs.btrfs -L main -n 32k /dev/mapper/luks # mkfs.btrfs -L alpinelinux -n 32k /dev/mapper/luks
``` ```
with `-n` the `nodesize`, larger nodesize gives better packing and less fragmentation at the cost of more expensive memory operations while updating metadata blocks. The default is 16k. with `-n` the `nodesize`, larger nodesize gives better packing and less fragmentation at the cost of more expensive memory operations while updating metadata blocks. The default is 16k.
The main partition needs to be mounted. To access the root volume it needs to be mounted.
``` ```
# mount /dev/mapper/luks /mnt -t btrfs # mount /dev/mapper/luks /mnt -t btrfs
``` ```
To create the necessary subvolumes in the main volume: Then to create the necessary subvolumes on the root volume, we use:
``` ```
for i in root home var nix; do for i in root home var nix; do
@ -66,7 +66,7 @@ for i in root home var nix; do
> done > done
``` ```
Unmount the main partition. Now unmount the root volume and provisioning is finished.
``` ```
# umount -lf /mnt # umount -lf /mnt

View file

@ -48,17 +48,17 @@ nav:
- 'Installation': alpine-desktop-setup/installation.md - 'Installation': alpine-desktop-setup/installation.md
- 'Post installation': - 'Post installation':
- 'Network': alpine-desktop-setup/post-install/network.md - 'Network': alpine-desktop-setup/post-install/network.md
- 'Security': alpine-desktop-setup/post-install/security.md
- 'Repositories': alpine-desktop-setup/post-install/repositories.md - 'Repositories': alpine-desktop-setup/post-install/repositories.md
- 'Users': alpine-desktop-setup/post-install/users.md - 'Security': alpine-desktop-setup/post-install/security.md
- 'Config files': alpine-desktop-setup/post-install/config-files.md - 'Init system': alpine-desktop-setup/post-install/initsystems.md
- 'Nix': alpine-desktop-setup/post-install/nix.md
- 'Zram': alpine-desktop-setup/post-install/zram.md
- 'Initsystems': alpine-desktop-setup/post-install/initsystems.md
- 'Firmware and drivers': alpine-desktop-setup/post-install/drivers.md - 'Firmware and drivers': alpine-desktop-setup/post-install/drivers.md
- 'Secureboot and automatic decryption': alpine-desktop-setup/post-install/automatic-decryption.md - 'Swap': alpine-desktop-setup/post-install/swap.md
- 'Automatic decryption': alpine-desktop-setup/post-install/automatic-decryption.md
- 'Power management': alpine-desktop-setup/post-install/power-management.md - 'Power management': alpine-desktop-setup/post-install/power-management.md
- 'Users': alpine-desktop-setup/post-install/users.md
- 'User packages': alpine-desktop-setup/post-install/user-packages.md
- 'Graphical session': - 'Graphical session':
- 'Config files': alpine-desktop-setup/graphical-session/config-files.md
- 'Session manager': alpine-desktop-setup/graphical-session/session-manager.md - 'Session manager': alpine-desktop-setup/graphical-session/session-manager.md
- 'Login manager': alpine-desktop-setup/graphical-session/login-manager.md - 'Login manager': alpine-desktop-setup/graphical-session/login-manager.md
- 'Window manager': alpine-desktop-setup/graphical-session/window-manager.md - 'Window manager': alpine-desktop-setup/graphical-session/window-manager.md
@ -73,17 +73,9 @@ nav:
- 'Provisioning': alpine-server-setup/installation/provisioning.md - 'Provisioning': alpine-server-setup/installation/provisioning.md
- 'Installation': alpine-server-setup/installation/installation.md - 'Installation': alpine-server-setup/installation/installation.md
- 'Post installation': - 'Post installation':
- 'Config files': alpine-server-setup/post-installation/config-files.md - 'Repositories': alpine-desktop-setup/post-install/repositories.md
- 'Users': alpine-server-setup/post-installation/users.md - 'Security': alpine-desktop-setup/post-install/security.md
- 'Repositories': alpine-server-setup/post-installation/repositories.md - 'Users': alpine-desktop-setup/post-install/users.md
- 'Network' : alpine-server-setup/post-installation/network.md
- 'Docker':
- 'Docker setup': alpine-server-setup/docker/setup.md
- 'Databases': alpine-server-setup/docker/databases.md
- 'Vaultwarden': alpine-server-setup/docker/vaultwarden.md
- 'Gitea': alpine-server-setup/docker/gitea.md
- 'Matrix': alpine-server-setup/docker/matrix.md
- 'Homeassistant': alpine-server-setup/docker/homeassistant.md
- 'Void-desktop setup': - 'Void-desktop setup':
- void-desktop-setup/index.md - void-desktop-setup/index.md