Forum: Cfengine Help
Subject: Re: Setting perms on home directory files
Author: phnakarin
Link to topic: https://cfengine.com/forum/read.php?3,17127,17128#msg-17128
I have done something like this to my machine. Firstly, create a list of users
based on directories under /home then ensure ownerships and permissions.
bundle agent ownership
{
vars:
linux::
"accounts" slist => {
readstringlist("/tmp/account_list.txt","#.*","[\n]","100","100000") };
"default_group" string => "users";
commands:
linux::
"/bin/ls -l /home | /bin/awk -F' ' '/drwx/{ print $9 }' >
/tmp/account_list.txt"
contain => in_shell;
files:
linux::
"/home/$(accounts)"
perms => mog("640","$(accounts)","$(default_group)"),
depth_search => recurse_include_basedir("inf");
}
##########
body depth_search recurse_include_basedir(d)
{
depth => "$(d)";
include_basedir => "true";
}
Cheers,
--Nakarin
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine