22 lines
586 B
Plaintext
22 lines
586 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
set -eu
|
||
|
|
||
|
USERNAME=soi
|
||
|
USER_FULLNAME="SOI"
|
||
|
# Password: soi
|
||
|
USER_PASSWORD='$y$j9T$h5VhMd4KkdmbxdZD1gO0N/$1hvwZgO8pQw13Xd6jaNXbtkbqVOC4W/ia/KXOcCGYvB'
|
||
|
|
||
|
# Delete user.
|
||
|
userdel --remove "$USERNAME" || true
|
||
|
|
||
|
# Create user.
|
||
|
adduser --disabled-password --gecos "$USER_FULLNAME" "$USERNAME"
|
||
|
usermod -p "$USER_PASSWORD" "$USERNAME"
|
||
|
adduser "$USERNAME" noauth
|
||
|
|
||
|
# If the corresponding boot menu item was selected, immediately power off.
|
||
|
if grep --quiet --word-regexp reset-user-poweroff /proc/cmdline; then
|
||
|
systemctl start poweroff.target --job-mode=replace-irreversibly --no-block
|
||
|
fi
|