Csak file illetve könyvtár jogosultság állítása

Erre a „parancsra” sokszor van szükségem, hisz a jól ismert chmod, chown parancsok önmagukba sajnos nem tudnak olyat, hogy csak file illetve könyvtár jogait módosítsuk vele. Eddig mindig előguberáltam, hogy pontosan hogy is van. Most meguntam és inkább lejegyzem, másnak is jól jöhet és legalább nekem is meg lesz.

A parancsok:

find path/ -type d -exec chmod a-x {} \; – a-x jogosultságot állít be minden könyvtáron a path/ könyvtárban! Fontos! CSAK könyvtárakra!
find path/ -type f -exec chmod a-x {} \; – a-x jogosultságot állít be minden filen a path/ könyvtárban! Fontos! CSAK filekra!

Akkor kis segítség, hisz jogosultságot nem csak statikus módon lehet megadni, mondjuk 775-öt. Hanem dinamikus módon is teszem azt mindenhonnan megvonhatjuk a group írási jogát. Ekkor a számok helyett először megadjuk, hogy user, groupe, other, vagy all jogát módosítjuk. Majd utána + vagy – és a jogokat. R,w,x ugye az olvasás, írás, futtatás. Figyelem Mac-esek! Ti is használhatjátok!

A teljesség kedvéért:

The references are used to distinguish the users to whom the permissions apply. They are represented by one or more of the following letters:

u (user) which represents the permissions granted to the owner of the file,
g (group) which represents the users who are members of the file’s group, and
o (others) which represents any users who are not the owner of the file or members of the group, or
a (all) which represents all three of the above, is the same as ugo.

The modes indicate which permissions are to be granted or taken away from the specified classes. There are three basic modes which correspond to the basic permissions:

r (read) which grants the ability to read the contents of a file or list a directory’s contents,
w (write) which grants the ability to modify the contents of a file or modify contents in a directory,
x (execute) which grants the ability to execute a file or recurse a directory tree, and
X (special execute) which is not a permission in itself but rather can be used instead of x. It applies execute to permissions to directories regardless of their current permissions and applies execute permissions to a file which already has at least 1 execute permission bit already set (either user, group or other). It is only really useful when used with ‘+’ and usually in combination with the -R option for giving group or other access to a big directory tree without setting execute permission on normal files (such as text files), which would normally happen if you just used „chmod -R a+rx .”, whereas with ‘X’ you can do „chmod -R a+rX .” instead.
s (setuid/gid) details are described in chapter „Special modes”
t (sticky) details are described in chapter „Special modes”

Finally, the chmod program uses an operator to specify how the modes of a file should be adjusted. The following operators are accepted:

+ which adds the specified modes to the specified classes,
which removes the specified modes from the specified classes, and
= which means that the modes specified are to be made the exact modes for the specified classes.

Csak file illetve könyvtár jogosultság állítása” bejegyzéshez egy hozzászólás

Hozzászólás a(z) NMyy bejegyzéshez Válasz megszakítása

Az e-mail címet nem tesszük közzé. A kötelező mezőket * karakterrel jelöltük