UNIX change permissions?

Discussion in 'Mac Basics and Help' started by motulist, Oct 24, 2010.

  1. motulist macrumors 601

    motulist

    Joined:
    Dec 2, 2003
    #1
    How do I batch change files' UNIX settings? I have web sharing turned on and have it set up so it's serve up the files and folders on my hard disk. It works great, but when I look at the folders it's showing in the web page, approximately 1 in 10 folders just isn't being displayed. The OS X permissions on these folders is all set to "read and write" for everyone, so I presume there is some sort of other UNIX or Apache file/folder settings that are keeping these folders from being displayed in the webpage. How do I make these hidden folders show up in my web page's displayed directory of folders?
     
  2. Makosuke macrumors 603

    Joined:
    Aug 15, 2001
    Location:
    The Cool Part of CA, USA
    #2
    OSX permissions combine standard UNIX (POSIX) permissions with ACLs for finer granular control. However, most files just have the POSIX permissions set by default, unless you've explicitly messed with them to add ACLs, and either way the Get Info window should show both. Keep in mind that Apache runs as its own user by default (at least, I think it does on OSX...), so it'll only be able to read files that are set readable by "all."

    Further, regardless of settings, I'd think the files would show up in a directory listing--you just wouldn't be able to read them.

    Can you give some examples of the filenames that aren't working? They may be set by Apache to not display.

    If you just want to mess with permissions, you'd want to use the chmod command with the -R flag (recursive, to modify contents of subfolders) make them readable to all, and remove ACLs for god measure. A quick Google search will turn up dozens of explanations of how to do this.
     
  3. motulist thread starter macrumors 601

    motulist

    Joined:
    Dec 2, 2003
    #3
    Okay, I figure it's much clearer if I show you the problem rather than trying to describe it in words.

    In the Finder you see all the folders that are in the directory, but then on the web page for that directory you can see that a bunch of the folders are not being listed.

    How do I fix this?
     

    Attached Files:

  4. motulist thread starter macrumors 601

    motulist

    Joined:
    Dec 2, 2003
    #4
    Troubleshooting that I've tried so far:




    1) Okay, this is weird. I just created a new empty folder titled "AAA" in that same directory, and when I refresh the web page, that new AAA folder isn't being listed either. WTH?

    2) I just loaded my directory-listing webpage on a different machine, and it isn't showing up there either, so it's definitely a problem on the webpage-generation/serving end.

    3) In system prefs I turned "websharing" off and then on again in order to restart Apache, and it didn't fix the problem.
     
  5. Makosuke macrumors 603

    Joined:
    Aug 15, 2001
    Location:
    The Cool Part of CA, USA
    #5
    Hmm... that is weird. It certainly looks like it should work from those images you posted, and there's no reason that filename would be problematic since the ones below it aren't.

    While restarting Web Sharing will restart apache, if there is some kind of caching issue that wouldn't necessarily help, depending on how the cache is stored and set to expire.

    Something to try: Type in the URL for a directory that isn't showing up, and see if you get a listing of its contents. That'll tell you if Apache is able to see the folder and just isn't listing it, or if it's actually unable to read the folder at all.

    I'll add that, when using a locally-served site through the built-in web sharing I've never seen any caching issues myself.

    I'm assuming here that you haven't made any significant changes to the Apache configuration apart from telling it to serve files from that drive.
     
  6. motulist thread starter macrumors 601

    motulist

    Joined:
    Dec 2, 2003
    #6
    I know, right?! That's what I thought too, which is why it's such a weird problem.


    Huh, I guess that's something to look into if we can't fix the problem with the stuff that you already know how to do.


    Holy crap, that works. When I directly typed in the URL of the un-listed folder, it properly opened up a webpage showing the contents of that un-displayed folder.


    Actually, I did make 2 changes. (for context, you can read this thread) I edited the config file so it would follow symbolic link aliases (FollowSymLinks) and I also edited it to display the full length of the directory items names (NameWidth=*). So this is currently the text of my config file:

    Code:
    <Directory "/Users/<username>/Sites/">
        Options Indexes MultiViews FollowSymLinks
        IndexOptions NameWidth=* 
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    Other than those 2 changes, I didn't knowingly change anything else, though I suppose it's possible that I may have accidentally changed something else along the way.
     
  7. motulist thread starter macrumors 601

    motulist

    Joined:
    Dec 2, 2003
    #7
    As a test, I deleted the NameWidth line, but that didn't fix the problem, the unlisted folders still weren't being shown in the directory listing.
     
  8. Makosuke macrumors 603

    Joined:
    Aug 15, 2001
    Location:
    The Cool Part of CA, USA
    #8
    This is good news, as it narrows it down considerably. Apache isn't having any trouble reading the files--which it shouldn't, since the permissions are fine--it's just not displaying them in directory listings.

    As to why the directory listings are getting randomly filtered, I can't currently think of anything obvious to try other than reverting the config file, which you already did. I'm assuming killing the symlinks line isn't an easy option since that's how you're redirecting to the external.

    Hopefully someone else has an idea tomorrow.
     

Share This Page