Skip to content

Commit

Permalink
Quote vars in user account manager
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Sep 19, 2024
1 parent 596f278 commit 0c80297
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions tabs/utils/user-account-manager/add_to_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ groups_to_add=$(echo "$groups" | tr ' ' ',')
read -p "Are you sure you want to add user $username to $groups_to_add? [Y/N]: " confirm
confirmAction || exit 1

$ESCALATION_TOOL usermod -aG $groups_to_add "$username"
"$ESCALATION_TOOL" usermod -aG $groups_to_add "$username"

printf "%b\n" "${GREEN}User successfully added to the $groups_to_add${RC}"

checkEnv
checkEnv
checkEscalationTool
5 changes: 3 additions & 2 deletions tabs/utils/user-account-manager/add_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ fi

password=$(promptPassword) || exit 1

$ESCALATION_TOOL useradd -m "$username" -g users -s /bin/bash
echo "$username:$password" | $ESCALATION_TOOL chpasswd
"$ESCALATION_TOOL" useradd -m "$username" -g users -s /bin/bash
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd

printf "%b\n" "${GREEN}User $username created successfully${RC}"
printf "%b\n" "${GREEN}To add additional groups use Add User To Groups${RC}"

checkEnv
checkEscalationTool
5 changes: 3 additions & 2 deletions tabs/utils/user-account-manager/change_password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ password=$(promptPassword) || exit 1
read -p "Are you sure you want to change password for $username? [Y/N]: " confirm
confirmAction || exit 1

echo "$username:$password" | $ESCALATION_TOOL chpasswd
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd
printf "%b\n" "${GREEN}Password changed successfully${RC}"

checkEnv
checkEnv
checkEscalationTool
5 changes: 3 additions & 2 deletions tabs/utils/user-account-manager/delete_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ fi
read -p "Are you sure you want to delete user $username? [Y/N]: " confirm
confirmAction || exit 1

$ESCALATION_TOOL userdel --remove "$username" 2>/dev/null
"$ESCALATION_TOOL" userdel --remove "$username" 2>/dev/null
printf "%b\n" "${GREEN}User $username deleted successfully${RC}"

checkEnv
checkEnv
checkEscalationTool
5 changes: 3 additions & 2 deletions tabs/utils/user-account-manager/remove_from_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ groups_to_remove=$(echo "$groups" | tr ' ' ',')
read -p "Are you sure you want to remove user $username from $groups_to_remove? [Y/N]: " confirm
confirmAction || exit 1

$ESCALATION_TOOL usermod -rG $groups_to_remove "$username"
"$ESCALATION_TOOL" usermod -rG $groups_to_remove "$username"

printf "%b\n" "${GREEN}User successfully removed from $groups_to_remove${RC}"

checkEnv
checkEnv
checkEscalationTool

0 comments on commit 0c80297

Please sign in to comment.