summaryrefslogtreecommitdiff
path: root/localresetpasswdexpiry
diff options
context:
space:
mode:
Diffstat (limited to 'localresetpasswdexpiry')
-rwxr-xr-xlocalresetpasswdexpiry5
1 files changed, 4 insertions, 1 deletions
diff --git a/localresetpasswdexpiry b/localresetpasswdexpiry
index 6d01eb2..93b26e7 100755
--- a/localresetpasswdexpiry
+++ b/localresetpasswdexpiry
@@ -30,6 +30,9 @@ vecho() {
u=$1
shift
+sudo=sudo
+[ "$(id -u)" -ne 0 ] || sudo=
+
vecho -n "Set password aging for $u (expire: $pass_expire, warn: $pass_warn, lastday: $pass_lastday)..."
-eval $simulate sudo "/usr/bin/chage -M$pass_expire -W$pass_warn -d$pass_lastday \"$u\""
+eval $simulate $sudo "/usr/bin/chage -M$pass_expire -W$pass_warn -d$pass_lastday \"$u\""
vecho " Done!"