Forum: Cfengine Help Subject: Password change problem. Author: dave.blackb...@dwbconsulting.com Link to topic: https://cfengine.com/forum/read.php?3,21361,21361#msg-21361
Hi I have being testing a new cfengine implementation where I have used the unit_root_passwd.cf as a template to change users passwords. The problem I have is that when the password hash is replaced the remaining colons are also stripped from the end of the line. This is causing problems with passwd & pwconv, I think this is to do with the field_separator but I don't seem to be able to resolve this issue. Has anyone else come across this problem. Thanks Dave # diff /var/cfengine/repository/_etc_shadow.cf-before-edit /etc/shadow 1c1 < root:$1$REMOVED8SS1:15070:0:99999:7::: --- > root:$1$REMOVEDuJE1:15070:0:99999:7 bundle agent SetRootPassword { files: "$(sys.workdir)/ppkeys/shadow.txt" copy_from => secure_cp("/var/cfengine/masterfiles/conf/all/all/etc/shadow.txt","$(g.phost)"); linux:: "/etc/shadow" edit_line => SetPasswd(); } bundle edit_line SetPasswd() { vars: # "myshadow" int => readstringarray("myshadow_array", "$(sys.workdir)/ppkeys/shadow.txt", "#[^\n]*",":","2","10000"); "shadow_users" slist => getindices("myshadow_array"); field_edits: "$(myshadow_array[$(shadow_users)][0]):.*" edit_field => column(":","2","$(myshadow_array[$(shadow_users)][1])","set"); } ######################################## # Bodies ######################################## body edit_field column(split,col,newval,method) { field_separator => "$(split)"; select_field => "$(col)"; value_separator => ","; field_value => "$(newval)"; field_operation => "$(method)"; extend_fields => "true"; } _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine