LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-24-2006, 05:38 AM   #1
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
Mass changing permissions based on file type.


Hi all,

I have a directory that I use as an SMB share that is used by both Windows and Linux computers. Over time the permissions have gone all over the place. I've now solved that problem so that all newly created files/directories will have appropriate permissions. However, most - if not all - exisiting files have inconsistent permissions that I'd like to remedy. Now I'm talking about something like 6,000 odd files so I'm not about to do it manually. The catch is that I want regular files to have one kind of permissions and directories another (as you'd probably expect) so blatantly passing the "-R" switch to chmod isn't going to solve my problem.

I've also tried using the find command like so:
Code:
chmod 664 `find -type f`
Unfortunately, chmod complains that the argument list is too long.

So does anyone know of an automated (iterative, maybe) method to accomplish this? I'm sure there must be since to me this sounds like a problem someone's had before. Unfortunately, google didn't come up with anything useful (at least not for the search strings I was using).

Thanks is advance.
 
Old 07-24-2006, 05:39 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

Try
find -type f -exec chmod 644 {} ";"
 
Old 07-24-2006, 05:45 AM   #3
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Original Poster
Rep: Reputation: 53
Excellent. Worked like a charm. Thank you very much.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing file-type of a text file olspookishmagus Linux - General 3 05-03-2006 01:00 AM
Changing the default file type icons in gnome on fedora C3 Sm1ler Linux - General 3 04-22-2005 10:43 AM
force delete/remove and mass file permissions-setting moxieman99 Linux - Newbie 2 02-15-2004 11:43 AM
What is changing my file permissions? lamekain Linux - Security 10 12-08-2003 04:22 AM
Changing file permissions on a SAMBA file share apenney Linux - Software 0 02-11-2002 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration