Skip to content

Commit 42e03eb

Browse files
committed
improve output of pwchange
1 parent 1c897bb commit 42e03eb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

usr/sbin/pwchange

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,39 @@ if [ "$(id -u)" != "0" ]; then
4141
exit 1
4242
fi
4343

44-
read -r -p "What user's password do you want to change? " user
44+
read -r -p "Enter the username whose password you want to change: " user
4545

4646
if [ "$user" = "" ]; then
47-
echo "ERROR: No user supplied" >&2
47+
echo "ERROR: No username provided. Please specify a username." >&2
4848
exit 1
4949
fi
5050

5151
if ! id "$user" &>/dev/null ; then
52-
echo "ERROR: No such user '$user'" >&2
52+
echo "ERROR: User '$user' does not exist. Please check the username and try again." >&2
5353
exit 1
5454
fi
5555

56-
echo -n "New password: "
56+
echo -n "Enter the new password for user '$user': "
5757
echo
5858
get_password
5959
first_input="$password"
6060
echo
6161

62-
echo -n "Retype new password: "
62+
echo -n "Re-enter the new password to confirm: "
6363
echo
6464
get_password
6565
second_input="$password"
6666
echo
6767

6868
if [ ! "$first_input" = "$second_input" ]; then
69-
echo "ERROR: Sorry, passwords do not match.
70-
password unchanged" >&2
69+
echo "ERROR: Passwords do not match. Password has not been changed." >&2
7170
exit 1
7271
fi
7372

7473
if [ "$first_input" = "" ]; then
75-
echo "ERROR: No password supplied" >&2
74+
echo "ERROR: No password provided. Please try again." >&2
7675
exit 1
7776
fi
7877

7978
echo "${user}:${password}" | chpasswd
79+
echo "SUCCESS: Password for user '$user' has been updated successfully."

0 commit comments

Comments
 (0)