.Op Fl R Op Fl H | L | P
.Op Fl C
.Ar
+.Nm chmod
+.Op Fl fv
+.Op Fl R Op Fl H | L | P
+.Op Fl N
+.Ar
.Sh DESCRIPTION
The
.Nm
Removes the 'inherited' bit from all entries in the named file(s) ACLs.
.It Fl I
Removes all inherited entries from the named file(s) ACL(s).
+.It Fl N
+Removes the ACL from the named file(s).
.El
.Sh COMPATIBILITY
The
#ifndef __APPLE__
while ((ch = getopt(argc, argv, "HLPRXfghorstuvwx")) != -1)
#else
- while ((ch = getopt(argc, argv, "ACEHILPRVXafginorstuvwx")) != -1)
+ while ((ch = getopt(argc, argv, "ACEHILNPRVXafginorstuvwx")) != -1)
#endif
switch (ch) {
case 'H':
case 'n':
acloptflags |= ACL_FLAG | ACL_NO_TRANSLATE;
break;
+ case 'N':
+ acloptflags |= ACL_FLAG | ACL_CLEAR_FLAG;
+ ace_arg_not_required = 1;
+ goto done;
case 'V':
acloptflags |= ACL_FLAG | ACL_INVOKE_EDITOR;
ace_arg_not_required = 1;
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
#include <membership.h>
#include "chmod_acl.h"
if (path == NULL)
usage();
+ if (optflags & ACL_CLEAR_FLAG) {
+ filesec_t fsec = filesec_init();
+ if (fsec == NULL)
+ err(1, "filesec_init() failed");
+ if (filesec_set_property(fsec, FILESEC_ACL,
+ _FILESEC_REMOVE_ACL) != 0)
+ err(1, "filesec_set_property() failed");
+ if (chmodx_np(path, fsec) != 0) {
+ if (!fflag)
+ warn("Failed to clear ACL on file %s", path);
+ retval = 1;
+ } else
+ retval = 0;
+ filesec_free(fsec);
+ return (retval);
+ }
+
if (optflags & ACL_FROM_STDIN)
oacl = acl_dup(modifier);
else {
#define ACL_REMOVE_INHERITED_ENTRIES (1<<10)
#define ACL_NO_TRANSLATE (1<<11)
#define ACL_INVOKE_EDITOR (1<<12)
+#define ACL_CLEAR_FLAG (1<<14)
#define INHERITANCE_TIER (-5)
#define MINIMUM_TIER (-1000)