From bb0c4ec01834980cb32b11e8520d8791ba80c130 Mon Sep 17 00:00:00 2001 From: Tommaso Chiti Date: Wed, 8 Dec 2021 19:21:10 +0100 Subject: [PATCH] Proper way to add a user. --- easy-arch.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/easy-arch.sh b/easy-arch.sh index a53d1a4..6b11cd0 100644 --- a/easy-arch.sh +++ b/easy-arch.sh @@ -323,10 +323,9 @@ arch-chroot /mnt /bin/passwd # Setting user password. if [ -n "$username" ]; then - print "Adding $username with root privilege." - useradd -m "$username" - usermod -aG wheel "$username" - echo "$username ALL=(ALL) ALL" >> /etc/sudoers.d/"$username" + print "Adding the user $username to the system with root privilege." + arch-chroot /mnt useradd -m -G wheel -s /bin/bash "$username" + sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /mnt/etc/sudoers print "Setting user password for $username." arch-chroot /mnt /bin/passwd "$username" fi