Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7012845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:18:31+00:00 2026-05-27T22:18:31+00:00

Update: turns out the problem is more complicated than I originally thought. I was

  • 0

Update: turns out the problem is more complicated than I originally thought. I was simultaneously trying to troubleshoot why my mkdir stopped working and it was because I had manually changed permissions of the parent directory to test then switched them back and added a chmod to the script which doesn’t work since that one is being run by apache and not myself. I’ll be posting a new question with the larger problem as I think adding all of this into this one will become confusing.


I’m a lab instructor at my university and I’ve been rewriting the script they provide for uploading assignments because the one they have is old and buggy. Instead of modifying the existing script (written in python) I’ve been writing it from scratch in php.

I’ve come across an issue where it seems that chown is not working. The php scripts run under the user apache. I’m not sure if that user is ‘priveleged’ or not but the original script used chown.

Can I assume that therefore apache should have the needed authority and that my issue lies elsewhere or is that faulty logic?


The server is the university’s and there is no way they will let me make any configuration changes. I do believe that it is CentOS that they’re running. There is no error message i just noticed that I can chmod the file and change the permissions but that the chown command on the next line seems to have no effect.

ls -al on the old scripts show:

-rwxr-xr-x 1 mattw labstaff 5067 Sep  1 17:52 File_Upload.cgi

Doesn’t look like the setuid bit is on.

Stefan mentioned “The user apache most likely doesn’t have enough permissions to chown a file/folder it does not own”. The directory I’m attempting to chown was just created with a mkdir so it should be owned by apache. Should chown work regardless of privilege when you already own the file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:18:32+00:00Added an answer on May 27, 2026 at 10:18 pm

    Apache probably doesn’t have the privileges to do so. It depends on which environment it’s running in. You said apache is running under the user apache, so I’m just going to assume that it’s RHEL or a RHEL variant such as Centos.

    You would be able to edit the sudoers file (with visudo) and give apache the ability to sudo without a password under a certain directory. Be aware that this isn’t recommended if you’re very security conscious.

    Adding something like

    apache ALL = NOPASSWD: /bin/chown 1[1-9][0-9][0-9]\:1[1-9][0-9][0-9] /var/www/[a-zA-Z0-9]*

    You may be able to add apache to a different group, or another user to the apache group or something of the sort and chmodding it to 0775 or 0664 instead.

    It would be best to post the code that’s throwing the error, the error message if any, and which users and groups need access to the files being uploaded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update : Alright, it turns out the reason that the below isn't working is
Update: Turns out this is undocumented behaviour of the NetStream class - NetStream loads
UPDATE: As it turns out, the below is caused by a caching issue on
Update: So, this turns out to have nothing to do with Tortoise SVN. I
I'm trying to figure out the correct approach (and pattern) that my current problem
Update: Solved, with code I got it working, see my answer below for the
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
Update: giving a much more thorough example. The first two solutions offered were right
Update: Thanks for everyone who helped out - the answer to this one lay
Original Question mysql-server-6.0.10 I have this problem, I'm using the COMPRESS function to update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.