Results 1 to 9 of 9

Thread: chown and chmod are not working

  1. #1
    Join Date
    Dec 2011
    Beans
    20

    chown and chmod are not working

    I created a folder: /var/www/test using sudo and now I'm trying to change the owner and permissions, but neither command has any affect. How do I fix this?

    Code:
    //None of these do anything
    sudo chmod -R 666 /var/www/test/
    chown -R myuser:mygroup /var/www/test
    chown -R :mygroup /var/www/test
    chown -R myuser /var/www/test
    It just continues to say the owner is root and only root has write permissions!

    Using: Ubuntu 10.04
    Last edited by 6tr6tr; May 23rd, 2013 at 07:47 AM.

  2. #2
    Join Date
    Dec 2011
    Beans
    20

    Re: chown and chmod are not working!

    WORK AROUND:

    It was a problem with the way I mounted the folder (which is a shared folder from VirtualBox host):

    Code:
    sudo mount -t vboxsf test /var/www/test
    Should have been:

    Code:
    #38 is www-data
    sudo mount -t vboxsf -o rw,uid=38,gid=38 test /var/www/test
    This allows my webserver to write to it, but there's still an issue. No matter who I mounted it under, I was unable to change chown/chmod afterwards. Is there any way to mount it so it allows changing ownership and permissions on subfolders and files?

  3. #3
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: chown and chmod are not working!

    try without specifying a uid or gid

  4. #4
    Join Date
    Dec 2011
    Beans
    20

    Re: chown and chmod are not working!

    Quote Originally Posted by HiImTye View Post
    try without specifying a uid or gid
    I tried that but that makes it so only root gets access and I'm unable to change it via chown or chmod.

  5. #5
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: chown and chmod are not working

    is the shared folder on a windows file system (FAT32/NTFS)? if so that will prevent you from dynamically changing ownership and permissions, since Windows filesystems aren't designed to be *nix friendly

  6. #6
    Join Date
    Dec 2011
    Beans
    20

    Re: chown and chmod are not working

    Quote Originally Posted by HiImTye View Post
    is the shared folder on a windows file system (FAT32/NTFS)? if so that will prevent you from dynamically changing ownership and permissions, since Windows filesystems aren't designed to be *nix friendly
    No, the host is opensuse.

  7. #7
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: chown and chmod are not working

    Quote Originally Posted by 6tr6tr View Post
    No, the host is opensuse.
    Does the host use SELinux or Apparmor? Or possibly the specific directory might have the immutable attribute set (chattr)?
    -BAB1

  8. #8
    Join Date
    Dec 2011
    Beans
    20

    Re: chown and chmod are not working

    Quote Originally Posted by bab1 View Post
    Does the host use SELinux or Apparmor? Or possibly the specific directory might have the immutable attribute set (chattr)?
    No to SELinux and apparmor.

    The permissions on the folder (in openSUSE):

    Code:
    drwxr-xr-x

  9. #9
    Join Date
    Dec 2011
    Beans
    20

    Re: chown and chmod are not working!

    Quote Originally Posted by HiImTye View Post
    try without specifying a uid or gid
    Just to see, I used a different host computer (a laptop using openSUSE 12.2 instead of 12.1) and created a new VirtualBox guest on that computer with Ubuntu 13.04 (instead of 10.04). I get the same results:

    1. Without specifying uid/gid, it gives permission denied

    2. With specifying, everything works properly

    Why would this be?

Bookmarks

Posting Permissions

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