[newbie] chmod directory and file?

2004-04-21 Thread Fajar Priyanto
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,
I found out that some directories and files that I copied from windows have 
777 in permission.

I tried to chmod -R 644 /directoryname, all files were correctly set into 644, 
but then all directories were also set into 644. I understand that directory 
must be set into 755? So, how do I set all files to 644 while also setting 
the directories into 755? 

I tried man chmod, but the only seemed related options was -R which gave me 
the wrong result.
TIA,
- -- 
Fajar Priyanto | Reg'd Linux User #327841 | http://linux.arinet.org
03:57:19 up 19:52, Mandrake Linux release 9.2 (FiveStar) for i586 
public key: https://www.arinet.org/fajar-pub.key
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAhuEgkp5CsIXuxqURAhF1AKCRAri9KWWs5NkSI4p/rDtF13cBhACfaU28
wwDcLRbg71uumBC+P9JXXz0=
=JUsk
-END PGP SIGNATURE-



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com



Re: [newbie] chmod directory and file?

2004-04-21 Thread Ron Hunter-Duvar
On April 21, 2004 15:01, Fajar Priyanto wrote:
 Hi all,
 I found out that some directories and files that I copied from windows have
 777 in permission.

 I tried to chmod -R 644 /directoryname, all files were correctly set into
 644, but then all directories were also set into 644. I understand that
 directory must be set into 755? So, how do I set all files to 644 while
 also setting the directories into 755?

 I tried man chmod, but the only seemed related options was -R which gave me
 the wrong result.
 TIA,

That's something I always thought was a deficiency of the chmod command in 
Unix, thatthere's no easy way to do this. They seemed to have propagated this 
deficiency to Linux. Should be an option that goes with -R, but there isn't.

There's an incantation with the find command that can do this. I can never 
remember it exactly, but it's in the man pages. Something like this:

  find . -type d -exec chmod 755 {} \;

where the . indicates the current directory. Put any other path there if 
you're not in the directory where you want to do this. I might not have the 
syntax exactly correct (could be you need a \ before the {} too).

-- 
Ron Hunter-Duvar

ronhd at users dot sourceforge dot net


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com