User Management
Rename User
Rename the user from foo to bar:
# usermod -l bar foo
Rename the group from foo to bar:
# groupmod -n bar foo
Rename user home directory:
usermod -d /home/bar -m bar
Add a system user and group
adduser --system --home /opt/USER --shell /bin/bash --group GROUP USER
Run command as an "ordinary" user
# runuser -u USER -- command arg1 arg2
or
# sudo -u USER [-g GROUP] command arg1 arg2
Reset root Password (GRUB)
Start the machine and press any key to stop the boot process.
Press [e] on GRUB menu to edit boot command line parameters.
Specify bash as init: find the line with kernel parameters (starts with linux) and add init=/bin/bash (use arrows, [Home] and [End] for navigation).
Press [Ctrl] + [x] or [F10] to boot.
The system will boot into single user mode with the root filesystem mounted as read-only. Re-mount it in r+w mode:
mount -n -o remount,rw /
Now, change the password
passwd
and reboot.
Alternatively if using systemd, add systemd.debug-shell=1 parameter and switch to 9-th console after boot (no need to remount anything).