Results 1 to 6 of 6
  1. #1

    "chmod() [function.chmod]: Operation not permitted"

    hi i have a VPS server which i have setup with,
    ubuntu 8.10
    Apache 2
    Mysql
    PHP 5 + GD Library
    PHPMyadmin
    VSFTP
    IP Tables Firewall
    Webalizer

    when using chmod in php i get this error

    "chmod() [function.chmod]: Operation not permitted"

    i think my permissions are wrong.

    i made a new user for my ftp within ubuntu called "gav", does my apache setup have to run on the same user ? or is php not running on the same user as apache.

    i have a phpinfo() file up but im not allowed to post links here bit silly so PM if you need it

    a example that fails
    PHP Code:
        chmod('/var/www/'755);
        
        
    $file '/var/www/test.txt';    
        
    $ourFileHandle fopen($file'w') or die("can't open file");
        
    fclose($ourFileHandle); 
    Thanks in advance, please note i am a new user to all this
    Last edited by gavshouse; 08-07-2009 at 11:08 AM.

  2. #2
    Join Date
    Apr 2005
    Posts
    1,711
    You can't chmod a directory you don't own.

    Try:

    ls -la /var/ | grep www

  3. #3
    ok that returned

    drwxr-xr-x 10 755 root 4096 Aug 7 18:29

    i restarted apache but it still dont work

  4. #4
    The folder is owned by user root. User apache can't set permission on this folder. Do chown -R apache:apache /var/www

  5. #5
    Join Date
    Jul 2009
    Posts
    178
    chattr -ia <file name>

    Guess a immutable it is set for that file.

  6. #6
    Quote Originally Posted by flashwebhost View Post
    The folder is owned by user root. User apache can't set permission on this folder. Do chown -R apache:apache /var/www
    ok i tried that but it returned
    chown: invalid user: apache:apache

    but i remember reading something about www-data being the default apache user so i tried did chown -R www-data /var/www and it fixed the problem but now my ftp is broke when i upload a file it says it cant store it i guess because my ftp is user "gav" is there a way to say

    "gav" & "www-data" own the folder ?

Similar Threads

  1. unable to chmod as root : Operation not permitted
    By goolex in forum Hosting Security and Technology
    Replies: 5
    Last Post: 12-13-2006, 12:28 PM
  2. chmod(): Operation not permitted in
    By listenmirndt in forum Dedicated Server
    Replies: 0
    Last Post: 04-07-2006, 12:11 PM
  3. Used to work yesterday: "touch(): Utime failed: Operation not permitted"
    By slice16 in forum Hosting Security and Technology
    Replies: 1
    Last Post: 06-13-2005, 09:13 AM
  4. [PHP] HELP! Warning: chmod(): Operation not permitted
    By sllik in forum Programming Discussion
    Replies: 2
    Last Post: 12-24-2004, 09:39 PM
  5. How do I use the "chmod function"?
    By Tropical Tundra in forum Programming Discussion
    Replies: 6
    Last Post: 03-31-2003, 01:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •