Remove the need for prompting the user for a password (#12)

Relates to issue #9
This commit is contained in:
Jason Hee authored and GitHub committed 2021-08-15 21:47:26 +08:00
1 parent ce73240765
commit 153087929c
4 files changed
+5 -27

No files matched your search

+2 -4
View File
@@ -3,12 +3,10 @@
# Add the new user account
# Arguments:
# Account Username
# Account Password
# Flag to determine if user account is added silently. (With / Without GECOS prompt)
function addUserAccount() {
local username=${1}
local password=${2}
local silent_mode=${3}
local silent_mode=${2}
if [[ ${silent_mode} == "true" ]]; then
sudo adduser --disabled-password --gecos '' "${username}"
@@ -16,8 +14,8 @@ function addUserAccount() {
sudo adduser --disabled-password "${username}"
fi
echo "${username}:${password}" | sudo chpasswd
sudo usermod -aG sudo "${username}"
sudo passwd -d "${username}"
}
# Add the local machine public SSH Key for the new user account