When I use chmod()
to change permissions at run time, it gives me the below message:
Warning: chmod() [function.chmod]: Operation not permitted in /home/loud/public_html/readalbum.php
How can I remove this error and make the chmod
function work?
“Operation not permitted” common causes The filesystem is not Linux-native (EXT, EXT2, EXT3, EXT4, JFS, Minix, ReiserFS, Reiser4, XFS) The file has the immutable flag set in its extended attributes. No root provileges. You need to be root to change the ownership of a file.
7777 means that everyone regardless of who is accessing the system has access to read, write, and execute.
A text file has 666 permissions, which grants read and write permission to everyone. A directory and an executable file have 777 permissions, which grants read, write, and execute permission to everyone.
$ sudo chmod ...
You need to either be the owner of the file or be the superuser, i.e., user root. If you own the directory but not the file, you can copy the file, rm the original, then mv it back, and then you will be able to chown it.
The easy way to temporarily be root is to run the command via sudo. ($ man 8 sudo
)
In order to perform chmod, you need to be owner of the file you are trying to modify, or the root user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With