Set group seting to multiple files

2002-09-12 Thread Pierre Dupuis

Good afternoon everyone :)

I expected a little problem, i have got a lot of files (Mp3s) organized 
in rep with sub rep, and i want to set a exec authorisation for a user. 
I know how to set it to a unique file, but there are more than one 
thousand files, so i wanted to do for each Mp3s (and to sub dir too) in 
only one command :)

Maybe someone can help :)))

Thanks

Pierre Dupuis
[EMAIL PROTECTED]

PS : Thanks for all previous reply, they help me a lot


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread Pierre Dupuis

OK !

I'm sorry to be a newbie :// I need more explanation.. I will be
more explicit

I've got some files owned by root and part as root group.
First i want to made them audio group.
Then i want to set a read permission for group audio on these files.

I have look at the man chmod but it is not very limpid.

Maybe someone can help me :)

Pierre Dupuis
[EMAIL PROTECTED]


dizma wrote:

 chmod 777 *
 
 rgds
 NN
 - Original Message -
 From: Pierre Dupuis [EMAIL PROTECTED]
 To: Mailing list utilisateurs Debian [EMAIL PROTECTED]
 Sent: Thursday, September 12, 2002 2:19 PM
 Subject: Set group seting to multiple files
 
 
 
 
 Good afternoon everyone :)
 
 I expected a little problem, i have got a lot of files (Mp3s) organized
 in rep with sub rep, and i want to set a exec authorisation for a user.
 I know how to set it to a unique file, but there are more than one
 thousand files, so i wanted to do for each Mp3s (and to sub dir too) in
 only one command :)
 
 Maybe someone can help :)))
 
 Thanks
 
 Pierre Dupuis
 [EMAIL PROTECTED]
 
 PS : Thanks for all previous reply, they help me a lot
 
 
 --
 To UNSUBSCRIBE, email to [EMAIL PROTECTED]
 with a subject of unsubscribe. Trouble? Contact
 
 
 [EMAIL PROTECTED]
 
 
 
 
 
 





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread martin f krafft

also sprach Pierre Dupuis [EMAIL PROTECTED] [2002.09.12.1319 +0200]:
 I expected a little problem, i have got a lot of files (Mp3s) organized 
 in rep with sub rep, and i want to set a exec authorisation for a user. 
 I know how to set it to a unique file, but there are more than one 
 thousand files, so i wanted to do for each Mp3s (and to sub dir too) in 
 only one command :)

assuming that your MP3s are in /music/mp3:

  chgrp -R music /music/mp3

-- this recursively changes the group of the files to 'music'

  chown -R pierre /music/mp3

-- this recursively changes the owner of the files to 'pierre'

  these two can be combined:

chown -R pierre.music /music/mp3

  then you should make them accessible to all in group music:

chmod -R o=rwX,g=rX,o= /music/mp3

and you are done.

one warning:

  NEVER, i repeat *N*E*V*E*R* use the -R flag to chmod/chgrp/chown if
  the final argument is not a directory. for instance

chown -R pierre /music/mp3/*

  will eventually change *your entire filesystem* to be owned by
  pierre!

-- 
martin;  (greetings from the heart of the sun.)
  \ echo mailto: !#^.*|tr * mailto:; net@madduck
 
when a woman marries again it is because she detested her first husband.
 when a man marries again it is because he adored his first wife.
 women try their luck; men risk theirs.
-- oscar wilde



msg01949/pgp0.pgp
Description: PGP signature


Re: Set group seting to multiple files

2002-09-12 Thread martin f krafft

also sprach martin f krafft [EMAIL PROTECTED] [2002.09.12.1333 +0200]:
 chmod -R o=rwX,g=rX,o= /music/mp3
   ^
   u=rwX

-- 
martin;  (greetings from the heart of the sun.)
  \ echo mailto: !#^.*|tr * mailto:; net@madduck
 
micro$oft dns service terminates abnormally
when it receives a response
to a dns query that was never made.
fix information: run your dns service on a different platform.
-- bugtraq



msg01953/pgp0.pgp
Description: PGP signature


Re: Set group seting to multiple files

2002-09-12 Thread Travis Crump

martin f krafft wrote:
 one warning:
 
   NEVER, i repeat *N*E*V*E*R* use the -R flag to chmod/chgrp/chown if
   the final argument is not a directory. for instance
 
 chown -R pierre /music/mp3/*
 
   will eventually change *your entire filesystem* to be owned by
   pierre!
 

Can someone else confirm this because this doesn't make any sense to me 
and I have never encountered it.  I just tried a couple of tests trying 
to confirm this and was unable to reproduce it.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread Keith Robinson

On Thu, Sep 12, 2002 at 01:49:33PM +0200, Pierre Dupuis wrote:
  OK !
  
  I'm sorry to be a newbie :// I need more explanation.. I will be
  more explicit
  
  I've got some files owned by root and part as root group.
  First i want to made them audio group.
  Then i want to set a read permission for group audio on these files.
  
  I have look at the man chmod but it is not very limpid.
  
  Maybe someone can help me :)
  
  Pierre Dupuis
  [EMAIL PROTECTED]
 

 snip

  chgrp audio file1 file2 ...

  OR

  chgrp -R audio dir

  This will change the group from root (or whatever) to audio - the first will do 
files, the second directories.  However, you need to be the owner in order to make any 
ownership/permission changes.

  chmod g+r file1 file2 ...

  OR

  chmod -R g+r dir

  This will give group read permissions - the first for individual files, the second 
for whole directories.

  Hope that's limpid enough for you, pierre ;)

 Keith 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread Ken Irving

On Thu, Sep 12, 2002 at 11:28:00AM -0400, Travis Crump wrote:
 martin f krafft wrote:
 one warning:
 
   NEVER, i repeat *N*E*V*E*R* use the -R flag to chmod/chgrp/chown if
   the final argument is not a directory. for instance
 
 chown -R pierre /music/mp3/*
 
   will eventually change *your entire filesystem* to be owned by
   pierre!
 
 
 Can someone else confirm this because this doesn't make any sense to me 
 and I have never encountered it.  I just tried a couple of tests trying 
 to confirm this and was unable to reproduce it.

I did this once, then panicked and halted the process when I heard 
a lot of disk activity.  The problem is (I think) that the wildcard
matches the .. file and the process recurses back into the parent
directory, etc.

I'd recommend using find for this sort of thing, as it allows you to 
select files and directories with a lot of flexibility, view them 
before doing anything, then do the job a file at a time.

$ find /music/mp3  # ... view  check the list of files 
$ find /music/mp3 -exec echo chown -R pierre {} \; # ... check commands
$ find /music/mp3 -exec chown -R pierre {} \; # ... do it

This is probably a lot slower than using recurse options in commands,
but I feel it can be safer.

-- 
Ken Irving [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread Colin Watson

On Thu, Sep 12, 2002 at 11:28:00AM -0400, Travis Crump wrote:
 martin f krafft wrote:
 one warning:
 
   NEVER, i repeat *N*E*V*E*R* use the -R flag to chmod/chgrp/chown if
   the final argument is not a directory. for instance
 
 chown -R pierre /music/mp3/*
 
   will eventually change *your entire filesystem* to be owned by
   pierre!
 
 Can someone else confirm this because this doesn't make any sense to me 
 and I have never encountered it.  I just tried a couple of tests trying 
 to confirm this and was unable to reproduce it.

It doesn't make any sense to me either. You can see what chown is doing
by adding the -v flag, and:

  [cjwatson@riva ~/tmp]$ sudo chown -v -R www-data svn-dump.*
  changed ownership of `svn-dump.142' to www-data
  changed ownership of `svn-dump.149' to www-data

There's other stuff under there, so I don't understand why -R on a file
could be bad.

-- 
Colin Watson  [[EMAIL PROTECTED]]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread martin f krafft

also sprach Colin Watson [EMAIL PROTECTED] [2002.09.12.1809 +0200]:
 It doesn't make any sense to me either. You can see what chown is doing
 by adding the -v flag, and:
 
   [cjwatson@riva ~/tmp]$ sudo chown -v -R www-data svn-dump.*
   changed ownership of `svn-dump.142' to www-data
   changed ownership of `svn-dump.149' to www-data
 
 There's other stuff under there, so I don't understand why -R on a file
 could be bad.

-R on files isn't, but -R with wildcards is just because it's too easy
to include .. in the wildcard.

note that my original warning was intentionally left vague because
i didn't want to flood the asker with complicated information.

having now checked it (chmod -R u+r ~/* is a non-destructive way in
98% of the cases), it seems that things changed. the reason i warned
was because i once fell victim to this, so i have engraved in my brain
that -R and * should not be used. from what i can tell, i have been
surfing happily, never using that combination, for the past 6 years or
so.

-- 
martin;  (greetings from the heart of the sun.)
  \ echo mailto: !#^.*|tr * mailto:; net@madduck
 
first snow, then silence.
this thousand dollar screen dies
so beautifully.



msg02012/pgp0.pgp
Description: PGP signature


Re: Set group seting to multiple files

2002-09-12 Thread Ken Irving

On Thu, Sep 12, 2002 at 05:20:48PM +0100, Colin Watson wrote:
 On Thu, Sep 12, 2002 at 08:07:24AM -0800, Ken Irving wrote:
  I did this once, then panicked and halted the process when I heard 
  a lot of disk activity.  The problem is (I think) that the wildcard
  matches the .. file and the process recurses back into the parent
  directory, etc.
 
 '*' doesn't match .. in normal (POSIX) shells. '.*' does, though.

I'm pretty sure I used the latter construct, since (I dimly recall)
I was trying to operate on files with a '.' in the name.  Thanks for
the clarification.  This defuses martin's warning to an extent, but
it's a gotcha that got me, and a learning experience.

-- 
Ken Irving [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread Alan Shutko

martin f krafft [EMAIL PROTECTED] writes:

 having now checked it (chmod -R u+r ~/* is a non-destructive way in
 98% of the cases), it seems that things changed. the reason i warned

chmod -R u+r ~/* is always (and has always been) non-destructive.  But
it's not complete, since it won't chmod dotfiles.  This leads people
to try

chmod -R u+r ~/* ~/.*

which _is_ destructive.  

In a case like that, it's always much better to do

chmod -R u+r ~

which works correctly.

-- 
Alan Shutko [EMAIL PROTECTED] - In a variety of flavors!
Source file - One which was appropriated from the competitors.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread Alan Shutko

martin f krafft [EMAIL PROTECTED] writes:

 /music/mp3/* includes .. and since you are doing things the recursive
 way...

No, it doesn't. 

Try echo * somewhere.

-- 
Alan Shutko [EMAIL PROTECTED] - In a variety of flavors!
Doubt grows with knowledge


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Set group seting to multiple files

2002-09-12 Thread martin f krafft

also sprach Alan Shutko [EMAIL PROTECTED] [2002.09.12.2003 +0200]:
 chmod -R u+r ~/* ~/.*
 
 which _is_ destructive.  

not with the zsh shell:

fishbowl:~/tmp chmod -vR u+r .* | head
zsh: no matches found: .*

(the dir contains no dotfiles.)

-- 
martin;  (greetings from the heart of the sun.)
  \ echo mailto: !#^.*|tr * mailto:; net@madduck
 
fermentation fault.
coors dumped.



msg02031/pgp0.pgp
Description: PGP signature