In the previous guide we installed Arch Linux (https://techwithkreplach.com/how-to-install-arch-linux-vm), but after installation our only user on the system is root.
It is safer to use linux as a different user than root, since this way there is less chance of you missclicking anything that can screw up the whole Operating System. Instead, every time you need to do something critical, the system will ask you for the sudo password.
Create a new user:
useradd -m <USERNAME>
option -m creates a new directory for this user in /home.
Create password for this user:
passwd <USERNAME>
this password will be used to log in into user. You will also have to type it every time when running a sudo command.
Open sudoers file with text editor:
nano /etc/sudoers
Add the following line right under "root ALL=(ALL:ALL) ALL" in section "# User privilege specification":
<USERNAME> ALL=(ALL:ALL) ALL
instead of <USERNAME> type the username you created in step 1. for example:
user1 ALL=(ALL:ALL) ALL
Close and save by clicking CTRL+X,then 'y' and ENTER
Log in to the new user:
su - <USERNAME>
Test that sudo works:
sudo pacman -Syu
"pacman -Syu" is a command that requires root privileges. If it runs then you have successfully created a new user with all sudo privileges.