Cambiare permessi SOLO di files

Utilizzate questo forum per qualsiasi argomento che non è categorizzato altrove.
Rispondi
fudu
Messaggi: 17
Iscritto il: 23 set 2008, 17:51

Cambiare permessi SOLO di files

Messaggio da fudu »

Avrei bisogno di modificare i permessi solo dei file contenuti un una cartella e NON delle directory
Ho provato, con putty

find . -type f -exec chmod xxx {} \;


ma ricevo questo messaggio:


BusyBox v1.01 (2008.09.03-19:03+0000) multi-call binary

Usage: find [PATH...] [EXPRESSION]

Search for files in a directory hierarchy. The default PATH is
the current directory; default EXPRESSION is '-print'

EXPRESSION may consist of:
-follow Dereference symbolic links.
-name PATTERN File name (leading directories removed) matches PATTERN.
-print Print (default and assumed).

-type X Filetype matches X (where X is one of: f,d,l,b,c,...)
-perm PERMS Permissions match any of (+NNN); all of (-NNN);
or exactly (NNN)
-mtime TIME Modified time is greater than (+N); less than (-N);
or exactly (N) days


Qualche suggerimento??
Avatar utente
luciano
Amministratore
Messaggi: 8706
Iscritto il: 25 apr 2008, 01:45
Località: Roma
Contatta:

Re: Cambiare permessi SOLO di files

Messaggio da luciano »

Ciao fudu, ad occhio direi che c'è un errore nella tua espressione, mi sembra che manchi il "cosa" nel predicato del find, dovrebbe essere:
find . "xxx" -type f -exec chmod 744 {} \;
trova (find) da dove ti trovi ora (.) questa cosa ("xxx") del tipo file (-type f) ed esegui (-exec) etc.etc.

N.B. occhio alle virgolette xchè mi pare di ricordare che in questo tipo di predicato ci vogliano nello specificare l'oggetto della ricerca.

Non posso commentare sul fatto se l'espressione faccia quello che ti serve xchè non mi è del tutto chiaro cosa devi fare di preciso.

HTH
fudu
Messaggi: 17
Iscritto il: 23 set 2008, 17:51

Re: Cambiare permessi SOLO di files

Messaggio da fudu »

luciano ha scritto:Ciao fudu, ad occhio direi che c'è un errore nella tua espressione, mi sembra che manchi il "cosa" nel predicato del find, dovrebbe essere:
find . "xxx" -type f -exec chmod 744 {} \;
trova (find) da dove ti trovi ora (.) questa cosa ("xxx") del tipo file (-type f) ed esegui (-exec) etc.etc.

N.B. occhio alle virgolette xchè mi pare di ricordare che in questo tipo di predicato ci vogliano nello specificare l'oggetto della ricerca.

Non posso commentare sul fatto se l'espressione faccia quello che ti serve xchè non mi è del tutto chiaro cosa devi fare di preciso.

HTH
No, il comando è giusto, se lancio il comando senza la parte -exec chmod 744 {} \; da come risultato in effetti tutti i file.
Però non li passa ad exec, sembra che non lo riconosca come opzione possibile...
Avatar utente
luciano
Amministratore
Messaggi: 8706
Iscritto il: 25 apr 2008, 01:45
Località: Roma
Contatta:

Re: Cambiare permessi SOLO di files

Messaggio da luciano »

E' esattamente quello che intendo: da solo funziona ma in quel costrutto che hai indicato devi modificare come ti ho detto.

Prova anche cosi:

Codice: Seleziona tutto

find . "*" -type f -exec chmod 744 {} \;
fudu
Messaggi: 17
Iscritto il: 23 set 2008, 17:51

Re: Cambiare permessi SOLO di files

Messaggio da fudu »

luciano ha scritto:E' esattamente quello che intendo: da solo funziona ma in quel costrutto che hai indicato devi modificare come ti ho detto.

Prova anche cosi:
find . "*" -type f -exec chmod 744 {} \;
no, niente da fare, da lo stesso risultato...
Avatar utente
luciano
Amministratore
Messaggi: 8706
Iscritto il: 25 apr 2008, 01:45
Località: Roma
Contatta:

Re: Cambiare permessi SOLO di files

Messaggio da luciano »

Con Solaris funziona cosi, forse è un limite di BusyBox. Faccio una googlata e ti dico.
Avatar utente
luciano
Amministratore
Messaggi: 8706
Iscritto il: 25 apr 2008, 01:45
Località: Roma
Contatta:

Re: Cambiare permessi SOLO di files

Messaggio da luciano »

su BusyBox:


find
find [PATH...] [EXPRESSION]

Search for files. The default PATH is the current directory, default EXPRESSION is '-print'

EXPRESSION may consist of:

-follow Dereference symlinks
-xdev Don't descend directories on other filesystems
-maxdepth N Descend at most N levels. -maxdepth 0 applies
tests/actions to command line arguments only
-name PATTERN File name (w/o directory name) matches PATTERN
-iname PATTERN Case insensitive -name
-path PATTERN Path matches PATTERN
-regex PATTERN Path matches regex PATTERN
-type X File type is X (X is one of: f,d,l,b,c,...)
-perm NNN Permissions match any of (+NNN), all of (-NNN),
or exactly (NNN)
-mtime DAYS Modified time is greater than (+N), less than (-N),
or exactly (N) days
-mmin MINS Modified time is greater than (+N), less than (-N),
or exactly (N) minutes
-newer FILE Modified time is more recent than FILE's
-inum N File has inode number N
-user NAME File is owned by user NAME (numeric user ID allowed)
-group NAME File belongs to group NAME (numeric group ID allowed)
-depth Process directory name after traversing it
-size N[bck] File size is N (c:bytes,k:kbytes,b:512 bytes(def.)).
+/-N: file size is bigger/smaller than N
-print Print (default and assumed)
-print0 Delimit output with null characters rather than
newlines USE_FEATURE_FIND_CONTEXT (
-context File has specified security context")
-exec CMD ARG ; Execute CMD with all instances of {} replaced by the matching files
fudu
Messaggi: 17
Iscritto il: 23 set 2008, 17:51

Re: Cambiare permessi SOLO di files

Messaggio da fudu »

luciano ha scritto:su BusyBox:


find
find [PATH...] [EXPRESSION]

Search for files. The default PATH is the current directory, default EXPRESSION is '-print'

EXPRESSION may consist of:

-follow Dereference symlinks
-xdev Don't descend directories on other filesystems
-maxdepth N Descend at most N levels. -maxdepth 0 applies
tests/actions to command line arguments only
-name PATTERN File name (w/o directory name) matches PATTERN
-iname PATTERN Case insensitive -name
-path PATTERN Path matches PATTERN
-regex PATTERN Path matches regex PATTERN
-type X File type is X (X is one of: f,d,l,b,c,...)
-perm NNN Permissions match any of (+NNN), all of (-NNN),
or exactly (NNN)
-mtime DAYS Modified time is greater than (+N), less than (-N),
or exactly (N) days
-mmin MINS Modified time is greater than (+N), less than (-N),
or exactly (N) minutes
-newer FILE Modified time is more recent than FILE's
-inum N File has inode number N
-user NAME File is owned by user NAME (numeric user ID allowed)
-group NAME File belongs to group NAME (numeric group ID allowed)
-depth Process directory name after traversing it
-size N[bck] File size is N (c:bytes,k:kbytes,b:512 bytes(def.)).
+/-N: file size is bigger/smaller than N
-print Print (default and assumed)
-print0 Delimit output with null characters rather than
newlines USE_FEATURE_FIND_CONTEXT (
-context File has specified security context")
-exec CMD ARG ; Execute CMD with all instances of {} replaced by the matching files
Ho scoperto l'inghippo...
Mi ha risposto il support tecnico QNAP e mi dice che....

"Our NAS doesn’t support file level permissions. Changing file permissions may cause unexpected problem.
Besides, -exec option is not supported on our NAS find command. "

... ho ricreato le cartelle e ritrasferito tutto...
Avatar utente
luciano
Amministratore
Messaggi: 8706
Iscritto il: 25 apr 2008, 01:45
Località: Roma
Contatta:

Re: Cambiare permessi SOLO di files

Messaggio da luciano »

Ottimo, grazie per averlo riportato, credo sarà utile ad altri come futuro riferimento, me compreso! 8-)
Pr3ssure
Messaggi: 5
Iscritto il: 31 ott 2009, 20:04

Re: Cambiare permessi SOLO di files

Messaggio da Pr3ssure »

ad oggi non è stata ancor aimplementata questa funzione ?

HO cercato e sto cercando un po' in giro cercando di capire anche come samba possa agire su questa cosa
avete ragguagli ?!

CIao ciao
Rispondi