Home / Blog /

How To Fix 'chmod: Operation not permitted' (Even As Root)

  • 0
  • 1 mins

Why is chmod showing the error: Operation not permitted?

You may be seeing messages like this when trying to change the permissions of a directory or file:

chmod: directory: Operation not permitted

There are basically two main possibilities here:

1. You're not doing it as root user

Let's say you just typed as a non-root user:

chmod -R 777 /directory/

If that directory doesn't belong to your user (i.e. isn't in /home/user/), then you will get the Operation not permitted error.

To solve this, use sudo or doas when chmod'ing.

doas chmod -R 777 /directory/

2. There are ACL's at a higher level preventing you from making changes

What's ACL?

Access Control List.

Think of this as a higher level mechanism for managing file system permissions.

acl may be a default mount option on a filesystem you're using or you may have it set in fstab.

To see if acl has anything to do with the problem you're having, type:

getfacl /directory/

This will show permissions.

To change acl permissions, use:

setfacl -m "u:username:rwx" /directory/

To remove acl permissions, use:

setfacl -b /directory/


See the FreeBSD man page to learn more.

Redpill your friends:

Related BSD goodness:

Donovan Nagel
Applied Linguistics graduate, translator and entrepreneur who uses FreeBSD and OpenBSD exclusively for work.
Subscribe to my YouTube channel.

Got something to share?

Comment Policy: This is a free-speech zone but cuntery isn't tolerated. Also no "Linux can do that" flame wars.
All comments are moderated before being published.