summaryrefslogtreecommitdiff
path: root/localdeluser
diff options
context:
space:
mode:
authorJonas <dr@jones.dk>2013-11-16 16:42:12 +0100
committerJonas <dr@jones.dk>2013-11-16 16:42:12 +0100
commitde91cb7bfb38a9ad14f2f4c614cbcef51e5c8e69 (patch)
treed8f18665aa6a561c1bb7e236a86fd86bd9b21252 /localdeluser
parent8fdbfa672945f45614d6b11c0b229757145d1a84 (diff)
Avoid sudo when executing as root.
Diffstat (limited to 'localdeluser')
-rwxr-xr-xlocaldeluser5
1 files changed, 4 insertions, 1 deletions
diff --git a/localdeluser b/localdeluser
index e6b6b6f..640d87b 100755
--- a/localdeluser
+++ b/localdeluser
@@ -11,4 +11,7 @@
# TODO: Only allow deleting regular users
#
-exec sudo /usr/sbin/adduser $1
+sudo=sudo
+[ "$(id -u)" -ne 0 ] || sudo=
+
+exec $sudo /usr/sbin/adduser $1