ACLs and cp

Andreas Gruenbacher a.gruenbacher at
Thu Jan 13 19:16:39 GMT 2000

Casey Schaufler wrote:
> Andreas Gruenbacher wrote:
> > The GNU fileutils do a chmod() with the umask bits masked out after copying:
> >
> >   > umask
> >   022
> >   > ls -l x
> >   -rw-rw-rw-   1 agruenba users           0 Jan 13 01:00 x
> >   > cp x y
> >   > ls -l y
> >   -rw-r--r--   1 agruenba users           0 Jan 13 01:05 y
> What to do regarding the attributes on a file that's cp'ed
> has always been contentious. The general rule for POSIX has
> been to preserve attributes with mv but to use them as guidence
> in cp. For example, the execute bits are preserved, but the
> umask is applied. For ACLs, it's probably best to either drop
> the ACL completely or preserve it without change. Remember that
> the 1e mechanism is designed to integrate well with the traditional
> mode bit behaviours. Applying the umask to the mode bit ought
> to suffice.

Right, mv preserves the ACL unmodified. This seems to be intuitively clear.

The current behavior of cp (without ACLs) is to copy the permissions, with the
umask applied (I don't know what you mean with `the execute bits are

DS17 states that the ACL should be copied by cp. To keep the behavior
consistent, I think it's best to do the equivalent of copying the ACL and then
chmod(file, ~umask(0)). The chmod() system call can of course be saved by
modifying the ACL.

What do you do on Irix?

What does Solaris do (I think it doesn't copy the ACLs)?


 Andreas Gruenbacher, a.gruenbacher at
 Contact information:
To Unsubscribe: send mail to majordomo at
with "unsubscribe posix1e" in the body of the message

More information about the posix1e mailing list