Browse code

BM-15554 Fix: check user exists before adding to group

Anthony Prades authored on 08/01/2020 11:42:14
Showing 1 changed files
... ...
@@ -45,11 +45,11 @@ manageSystemUserGroup() {
45 45
     getent group bluemind > /dev/null || addgroup --system bluemind
46 46
 
47 47
     # Add user cyrus to group bluemind, if such group and user exists
48
-    adduser cyrus bluemind || true
48
+    getent passwd cyrus >/dev/null && adduser cyrus bluemind
49 49
     # Add user www-data to group bluemind, if such group and user exists
50
-    adduser www-data bluemind || true
50
+    getent passwd www-data >/dev/null && adduser www-data bluemind
51 51
     # Add user telegraf to group bluemind, if such group and user exists
52
-    adduser telegraf bluemind || true
52
+    getent passwd telegraf >/dev/null && adduser telegraf bluemind
53 53
 }
54 54
 
55 55
 manageSystemUserGroup