Changing permissions via chmod at runtime errors with “Operation not permitted”

前端 未结 4 1139
夕颜
夕颜 2021-02-12 13:18

When I use chmod() to change permissions at run time, it gives me the below message:

Warning: chmod() [function.chmod]: Operation not permitt

4条回答
  •  悲&欢浪女
    2021-02-12 13:44

    $ 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)

提交回复
热议问题