Add user only if it does not exist. (#1059)

If user already exists, useradd ends with error and terminates the whole instalation process.
This commit is contained in:
budulinek 2020-01-19 03:22:57 +01:00 committed by nachoparker
parent 6359ca307d
commit e0ae40b8db

2
ncp.sh
View File

@ -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"