Bug 673091 - No file in /etc/skel is copied by useradd
Summary: No file in /etc/skel is copied by useradd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: shadow-utils
Version: 5.6
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Peter Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
: 673241 (view as bug list)
Depends On:
Blocks: 690829
TreeView+ depends on / blocked
 
Reported: 2011-01-27 12:12 UTC by Masahiro Matsuya
Modified: 2018-11-14 15:40 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-21 06:16:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
updated ACL patch (2.80 KB, patch)
2011-02-09 16:17 UTC, Peter Vrabec
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Legacy) 45094 0 None None None Never
Red Hat Product Errata RHBA-2012:0244 0 normal SHIPPED_LIVE shadow-utils bug fix update 2012-02-20 15:07:21 UTC

Description Masahiro Matsuya 2011-01-27 12:12:50 UTC
Description of problem:
No file in /etc/skel is copied by useradd

This is a regression by https://bugzilla.redhat.com/show_bug.cgi?id=513055.
This bugzilla introduced a feature to copy acl information of files with libacl.
This problem doesn't occur on RHEL 5.5, but it occurs on RHEL5.6.

But, in case that any filesystem is mounted on /home without acl option, it fails to copy (set) acl information to a home directory in /home.

It seems that the root filesystem can deal with acl by default. I guess that it's related with selinux enabled. So, when /home is in the root filesystem, this problem doesn't occur.

useradd fails and exits on the way when it tries to copy the acl information of *directory*. It calls perm_copy_file() in libacl to copy the directory and it returns a value except for 0. On the other hand, when it copies the acl information of regular file, it calls perm_copy_fd() in libacl. Although it fails to copy the acl information as a case of directory, it can copy the file mode successfully and it returns 0 meaning "no error". So, in case of regular file, it can proceed forward.

I am still not sure we should fix this issue in shadow-utils or acl package.
If we can fix it in shadow-utils, we need to check if acl is enabled on the filesystem including /home before calling perm_copy_file().


Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux 5.6
shadow-utils-4.0.17-18.el5


How reproducible:
Always

Steps to Reproduce:
1. install RHEL 5.6
2. make the filesystem for /home and mount it without acl option
3. useradd tester
  
Actual results:
The following error is outputed and all files in /etc/skels are not copied.
copydir(): preserving permissions for /home/kikuchi/.kde: Operation not supported 

Expected results:
Even when acl is not enabled in the filesystem on /home, useradd can copy all files and directories in /etc/skels to the home directory of the new user.

Additional info:

Comment 2 Kamil Dudka 2011-02-03 18:56:09 UTC
(In reply to comment #0)
> I am still not sure we should fix this issue in shadow-utils or acl package.

perm_copy_file() works as expected.  It fails with ENOSYS if the operation is not supported.  It is up to shadow-utils how it handles the error code, and if it prints any error at all.

> If we can fix it in shadow-utils, we need to check if acl is enabled on the
> filesystem including /home before calling perm_copy_file().

That feels wrong to me.  Better would be to just call perm_copy_file() and then check its result.  Otherwise you're introducing unnecessary race condition and problems with unreliable detection of the ACL support.

Comment 5 Peter Vrabec 2011-02-09 16:17:57 UTC
Created attachment 477851 [details]
updated ACL patch

this updated solution basically ignore EOPNOTSUPP from perm_copy_file/perm_copy_fd on both levels:
1. error message is not printed
2. return code == 0

I don't know any better way :(

Comment 6 Peter Vrabec 2011-02-09 16:28:09 UTC
*** Bug 673241 has been marked as a duplicate of this bug. ***

Comment 9 Ferry Huberts 2011-04-13 09:15:26 UTC
please hurry a patch for this bug, I have to implement a rather complicated workaround in my products right now... :-(

Comment 10 Ferry Huberts 2011-04-13 10:08:51 UTC
workaround:

change the default mount options of /home:
ext2/3:   tune2fs <mountpoint> -o user_xattr,acl
ext4:     tune4fs <mountpoint> -o user_xattr,acl

remount:
  mount /home -o remount,user_xattr,acl

Comment 11 Fco Romo 2011-04-20 01:33:50 UTC
Got the same problem using a GFS2 volume as the "/home" directory for my users. Directories from /etc/skel are created by "useradd" but no files are copied:

copydir(): preserving permissions operation for *OMITTED* not supported

Using a ext3 volume for a home directory works OK.

Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.6 (Tikanga)
Release:        5.6
Codename:       Tikanga

Comment 14 Fco Romo 2011-04-20 15:41:31 UTC
Got the same problem using a GFS2 volume as the "/home" directory for my users. Directories from /etc/skel are created by "useradd" but no files are copied:

copydir(): preserving permissions operation for *OMITTED* not supported

Using a ext3 volume for a home directory works OK.

Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.6 (Tikanga)
Release:        5.6
Codename:       Tikanga

Comment 15 Arne Berglund 2011-05-14 03:40:16 UTC
Any progress on this? I've been forced to roll back to the prior version on my production mail server to get the .procmailrc to copy over to home directories on an external array. Would love to be get back current.

Comment 16 Ferry Huberts 2011-05-14 08:05:50 UTC
see comment 10

Comment 20 errata-xmlrpc 2012-02-21 06:16:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0244.html


Note You need to log in before you can comment on or make changes to this bug.