Re: getting "chmod(): Operation not permitted" on attempted file changes



javelin wrote:

I have a script that works fine on one server, but not on another. I
upload files thru this script, and am trying to modify them after
this, but I get the following message: "Warning: chmod(): Operation
not permitted"

I was told that this is because the file is created by "nobody", so
only "nobody" may edit the file. Can anyone advise on how to execute
scripts as this "nobody"? Also, how do I display a list of valid
users?

Thanks.

J

Your server has their web service set to run PHP in the web server's
API, and it runs as the global web server user (nobody), instead of the
uid (user ID) of your own user. If a file is created and owned by the
nobody user, it means you'll have to have a script (also running as
nobody) perform the permission change via chmod. However, it can fail
if the directory it's in isn't set to read, write and execute. The
directory itself would need to be owned by the nobody user unless the
world (other) group was allowed read, write and execute.

If your host recently changed from mod_php (Apache API), for example, to
phpsuexec or suPHP, which runs it as CGI as your own user, then any
nobody owned files will need to be changed to your user and group
ownership. However, it sounds like they have it set to run in the
Apache API amd the permissions just need to be set on the directory
that file is in that you want to run chmod against. Ideally, ask your
host for help, unless this is your own server.

By the way, maybe I'm mistaken, did you have the PHP script create the
file and then tried to run chmod via FTP or a control panel interface,
or in shell? This is actually a simple problem and fix, I just don't
want to guess too much about the actual issue and cause any confusion.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
.



Relevant Pages

  • Re: sanitizing uploaded data with a form
    ... i'm escaping quotes for the database, but i wasn't sure what other ... If the script is to display them, ... especially someone else on the server, if you use a shared server and ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
    (alt.php)
  • Re: getting "chmod(): Operation not permitted" on attempted file changes
    ... I upload files thru this script, and am trying to modify them after ... only "nobody" may edit the file. ... Your server has their web service set to run PHP in the web server's ... By the way, maybe I'm mistaken, did you have the PHP script create ...
    (alt.php)
  • Re: getting "chmod(): Operation not permitted" on attempted file changes
    ... I upload files thru this script, and am trying to modify them after ... only "nobody" may edit the file. ... unless this is your own server. ...
    (alt.php)
  • Re: Kill processes after web page closes
    ... script and build a new web page based on input. ... Appache server send TERM or QUIT signal ... Those (signals) aren't sent or captured from the browser. ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
    (comp.lang.perl.misc)
  • Re: sanitizing uploaded data with a form
    ... If the script is to display them, ... server and the admins allow PHP scripts to all run as the same global ... configured, including, of course, the PHP upload script itself. ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
    (alt.php)