Forum: CFEngine Help
Subject: add users to /etc/shadow
Author: tuibelgium
Link to topic: https://cfengine.com/forum/read.php?3,22920,22920#msg-22920

>From the cfengine sollutions page I've used this code to do some testing.

bundle agent addusers
{
vars:

  # Add some users

  "pw" string => "test:x:1106:1106:test:/home/test:/bin/bash";

  "users" slist => getindices("pw");

files:

  "/etc/passwd"
     edit_line => append_users_starting("addusers.pw");

  "/etc/shadow"
     edit_line => append_users_starting("$(users):defaultpasswd:::::::");
}

Users are added to /etc/passwd but not to /etc/shadow. I think it's because 
they already exist in /etc/passwd at the time it tries to add them to 
/etc/shadow. 
This output is generated:
Skipping whole next edit promise ($(test:defaultpasswd:::::::[$(index)])), as 
var-context add_$(index) is not relevant


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to