Forum: CFEngine Help
Subject: split user passwd array
Author: tuibelgium
Link to topic: https://cfengine.com/forum/read.php?3,24257,24257#msg-24257
To add users I use the following config:
vars:
"pw" string => "username1:x:1101:1101:user name:/home/user:/bin/bash";
"pw" string => "username2:x:1102:1101:user name:/home/user:/bin/bash";
"pw" string => "username3:x:1103:1101:user name:/home/user:/bin/bash";
"pw" string => "username4:x:1104:1101:user name:/home/user:/bin/bash";
"users" slist => getindices("pw");
files:
linux::
"/etc/passwd"
edit_line => append_passwd_starting("addusers.pw");
Now I want to split the string that is assigned to a user. So that is is
possible to change a specific value.
I'v been experimenting with parsestringarry, but I can only use one variable
f.e. $(pw) and not $(pw[$(users)])
Is it possible to parse the whole array?
The goal of this is to make it possible to change a user's home dir, or shell.
Or to check if a userid already exists in /etc/passwd.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine