From e0ae40b8dbaeabbbe57fcb85dd8f6975216227e9 Mon Sep 17 00:00:00 2001 From: budulinek Date: Sun, 19 Jan 2020 03:22:57 +0100 Subject: Add user only if it does not exist. (#1059) If user already exists, useradd ends with error and terminates the whole instalation process. --- ncp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncp.sh b/ncp.sh index 69db9872..4e532c9e 100644 --- a/ncp.sh +++ b/ncp.sh @@ -123,7 +123,7 @@ EOF a2ensite ncp-activation ## NCP USER FOR AUTHENTICATION - useradd --home-dir /nonexistent "$WEBADMIN" + id -u "$WEBADMIN" &>/dev/null || useradd --home-dir /nonexistent "$WEBADMIN" echo -e "$WEBPASSWD\n$WEBPASSWD" | passwd "$WEBADMIN" chsh -s /usr/sbin/nologin "$WEBADMIN" -- cgit v1.2.3