Skip to content

Commit e0ae40b

Browse files
budulineknachoparker
authored andcommitted
Add user only if it does not exist. (#1059)
If user already exists, useradd ends with error and terminates the whole instalation process.
1 parent 6359ca3 commit e0ae40b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ncp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ EOF
123123
a2ensite ncp-activation
124124

125125
## NCP USER FOR AUTHENTICATION
126-
useradd --home-dir /nonexistent "$WEBADMIN"
126+
id -u "$WEBADMIN" &>/dev/null || useradd --home-dir /nonexistent "$WEBADMIN"
127127
echo -e "$WEBPASSWD\n$WEBPASSWD" | passwd "$WEBADMIN"
128128
chsh -s /usr/sbin/nologin "$WEBADMIN"
129129

0 commit comments

Comments
 (0)