Newbie question on folder and file permissions


#1

im fairly a newbie when it comes to unix-like folder permissions, etc. and i am wondering if people can shed light on some of these:

  1. if a folder/directory has the permissions “drwx------,” - it would mean that only the owner has access to the directory, right? not even those in the same group as the owner can get into the directory, right?
  2. now, what if a file under this specific directory has a permission of “-rw-r–r--” - what would this mean? i would understand that the permission is that those from the group, as well as ‘others’ can read the file. however, if they dont have access to folder, can they actually READ it then?
  3. in regards to this, what would be the recommended folder and file permissions for offsite backup of my local pc?

thanks in advanced…


#2

Yes.

Read permission on a directory just controls whether you can do a directory listing for it; without execute permission on a directory, you can’t access any file within it, even if you know its path.

Keep it outside the webroot (not under any of your domains, that is), and CHMOD it to 600 (rw------).

emufarmers.com
Very little to do with either emus or farmers!


#3

thanks for the reply Emufarmers

just to follow-up, though - as long as i have “drwx------” on the directory AND having it outside the web root (ie., the domain), then it doesnt really matter what permissions i set for each individual file then (because non-owners cant get into the directory in the first place)?


#4

If you have it outside of the webroot it should be safe against viewing from the web, period (someone in your group could still view it through the shell, theoretically), but you’ll sleep sounder knowing the permissions are set too.

emufarmers.com
Very little to do with either emus or farmers!