Forum: Cfengine Help
Subject: Re: Problem with special characters
Author: max_fr
Link to topic: https://cfengine.com/forum/read.php?3,21179,21185#msg-21185
berntjernberg,
Here is my complete code:
bundle agent root_pwd_update(new_pwd) {
vars:
"old_pwd" int =>
readstringarray("shadow_array","/etc/shadow","#[^\n]*",":",200,10000);
classes:
"uppwd" not => strcmp("$(new_pwd)","$(shadow_array[1])");
files:
uppwd.hpux::
"/etc/shadow"
edit_line => set_user_field("root", 2,
"$(new_pwd)");
commands:
uppwd.redhat::
"/bin/echo"
args => "root:$(new_pwd) |
/usr/sbin/chpasswd -e",
contain => in_shell;
reports:
uppwd::
"The root password on $(sys.host) has been changed";
}
If the hash password string does not contain single quote, i get this in my
/etc/shadow
root:sF.c.I5aWMoAj8LpMtOW1:15050:0:99999:7:::
Cheers
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine