• The Forums are now open to new registrations, adverts are also being de-tuned.

Nix Directory Permissions

Spinal

MB Enthusiast
Joined
Sep 14, 2004
Messages
4,806
Location
between Uxbridge and the Alps
Car
x254, G350, Duster, S320, Mach1, 900ss and a few more
Hopefully a fast one...

In this example:
\foo\bar\file.txt

foo: drwxrwxrwx
bar: drwxr-xr-x
file.txt: drwx------

So in essence, only the owner can access the file... right?

Or can someone edit the permissions as the directory above is editable?

I know this is a simple one, but my brain just went blank!

M.
 
Hmm, I'm perplexed... just booted a vm and tried it - it works as I expected.. you can't change the permissions if you aren't the owner or are in an edit group...

Someone's playing games with me...
M.
 
I know this is a simple one, but my brain just went blank!

The rwx file permissions are attached to the file and have nothing to do with the parent directory as long as the directory provides you with x permission to get to the file.

To 'delete' the file you need w permission on the parent directory. That's because you're not actually deleting it but unlinking it (and if the number of links drops to zreo the file is deleted).

Watch out for access control list as attributes.
 
Yeah - I was right then :)

Essentially, a client asked me to write a script to do some FIM/HIM... but his logic was that the parent directories needed to be checked for permissions as well, all the way to root instead of just the file. Seemed very windows-y, with inherited permissions!

Quite pleased, it's been a while since I've delved in *nix and I caught out a "real" nix admin on a tiny issue :p My am I childish :p

Thanks :)
m.
 
Is it me or is this a learn a Klingon thread???
 
Its easier to learn Klingon, this is the black art of *nix permissions.
 
Essentially, a client asked me to write a script to do some FIM/HIM... but his logic was that the parent directories needed to be checked for permissions as well, all the way to root instead of just the file. Seemed very windows-y, with inherited permissions!

The basic tradition was that each file is associated with a uid, gid, and a bit mask with permissions. Each file was uniquely identified on the file system volume by a unique id. A directory was just a file containing names and the unique ids corresponding to files.

A file may be referenced by more than one directory.

So the same file (or directory file) can be accessed via multiple paths.

This means that inherited ownership and permissions are not meaningful. Each directory in the path is a potential access route or barrier to the files (or directories) it references but they are otherwise unrelated to it.
 

Users who are viewing this thread

Back
Top Bottom