From 684084dbf1704061dcf76518baf9827cfb97ee55 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Wed, 18 Feb 2015 11:09:08 +0100 Subject: [PATCH] Copy security attributes of root skeleton MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The xattr of the root of the skeleton are now copied when the home directories of users are created. This patch is needed to set default Smack attributes to home directories. For example, for automatically setting the Smack access of home directories to User::Home and their transmute value to TRUE for the newly created users, it is now enough to issue chsmack -a User::Home -t /etc/skel where /etc/skel is the skeleton directory used when creating users. Change-Id: I0a310d03b5fc335a54fad09b1bbff2be107fbb06 Signed-off-by: José Bollo --- src/useradd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/useradd.c b/src/useradd.c index 568e9be..27a743f 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -1121,7 +1121,8 @@ create_home_directory (const char *home, uid_t uid, gid_t gid, if (skeldir != NULL && *skeldir != '\0' && access (skeldir, F_OK) == 0) { - if (copy_dir_rec (skeldir, home, 0, uid, gid) != 0) + if (copy_xattr (skeldir, home) != 0 || + copy_dir_rec (skeldir, home, 0, uid, gid) != 0) { fprintf (stderr, _("%s: Copying of skel directory failed.\n"), program); -- 2.7.4