I am using mog to set the permissions on home directories using a promise I 
found on the forum and for some reason it is not setting permissions correctly. 
 I also tried to manually set the group value to users with no luck.  Has 
anyone else run into this issue and found a solution?


#########################################################
#
# Check home file ownership and perms

bundle agent home_ownership
{
vars:
        # Put all users in /etc/passwd into the array "HomeDir", excluding 
entries
        # with a uid 1-199, nobody (-2), oracle (204), applmgr (205) hpsmh 
(430),
        # nfsnobody (65534, 4294967294) and ids (1000).  Note: the pattern 
"[*x]"
        # is used in the password field due to incorrect results on linux 
systems
        # when ".*" was used.
        "HomeDirn"      int     => readstringarray(
                                "HomeDir",
                                "/etc/passwd",
                                
".*:[*x]:([0-9]|\d{2}|1\d{1,2}|-2|204|205|430|65534|4294967294|1000):.*",
                                ":",
                                "300",
                                "12000"
                                );

        "HomeUsr"       slist   => getindices("HomeDir");

#reports:
#       any::
#         "$(HomeDir[$(HomeUsr)][5])";

files:
        # "/local/users/" delete => tidy, file_select => plain, depth_search => 
recurse("inf");
        #"/local/users/" delete => tidy, file_select => dirs, depth_search => 
recurse("inf");
        #"/local/users" delete => homedirs;
        "/local/users/" create => "true", depth_search =>recurse("inf");
        "/users" link_from => ln_s("/local/users");
        #"/users/" delete => tidy, file_select => plain, depth_search => 
recurse("inf");
        #"/users/" delete => tidy, file_select => dirs, depth_search => 
recurse("inf");
        #"/users" delete => homedirs;
       "$(HomeDir[$(HomeUsr)][5])/"
                   perms           => 
mog("755","$(HomeDir[$(HomeUsr)][2])","$(HomeDir[$(HomeUsr)][3])"),
                create          => "true",
                depth_search    => recurse("inf");

}

body delete homedirs{
  dirlinks => "delete";
  rmdirs   => "true";
}




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

Reply via email to