Proper way to add a user.

This commit is contained in:
Tommaso Chiti 2021-12-08 19:21:10 +01:00
parent d1cb7e0b05
commit bb0c4ec018

View file

@ -323,10 +323,9 @@ arch-chroot /mnt /bin/passwd
# Setting user password. # Setting user password.
if [ -n "$username" ]; then if [ -n "$username" ]; then
print "Adding $username with root privilege." print "Adding the user $username to the system with root privilege."
useradd -m "$username" arch-chroot /mnt useradd -m -G wheel -s /bin/bash "$username"
usermod -aG wheel "$username" sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /mnt/etc/sudoers
echo "$username ALL=(ALL) ALL" >> /etc/sudoers.d/"$username"
print "Setting user password for $username." print "Setting user password for $username."
arch-chroot /mnt /bin/passwd "$username" arch-chroot /mnt /bin/passwd "$username"
fi fi