LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-14-2003, 12:45 AM   #1
food188
LQ Newbie
 
Registered: Oct 2003
Posts: 5

Rep: Reputation: 0
Changing Many Permissions at Once


I was wondering if there is a quick and easy way to change many (1000+) file permissions at the same time? I have a lot of files that currently belong root and I want to change them to belong to my user without having to individually change every single one.
 
Old 10-14-2003, 12:54 AM   #2
salparadise
Senior Member
 
Registered: Nov 2002
Location: Birmingham UK
Distribution: Various
Posts: 1,736

Rep: Reputation: 146Reputation: 146
chmod -R xxx

-R says change file permissions recursively
or

eg/
chmod -R 777 /mnt/windows would chamge the permission of every folder within /mnt/windows
 
Old 10-14-2003, 07:41 PM   #3
Read_Icculus
Member
 
Registered: Oct 2002
Distribution: MDK 9.2, Debian
Posts: 74

Rep: Reputation: 16
To complicate things a bit here's my 2c. If you have a folder/group of folders that has mixed files and you don't want to change all of them, as you would with the --recursive flag on chmod you can do the following -

find $options_to_get_those_files_you_want_to_change_only | xargs chmod $permissions

I've never needed to use the "find|xargs" combo for chmoding as the -R flag usually suits my needs, but for commands that don't have a recursive option and for those situations where you want to modify only part of a mass of stuff, the "find|xargs" combo is very useful.

For example the "shred" command cannot be used recursively, so if I had a folder that contains a few dozen other folders full of files and I wanted to shred all of the .jpgs in all of those folders I could use the following command -

find *.jpg | xargs shred -uzx -n 10
 
Old 11-02-2003, 08:17 AM   #4
loonix
Member
 
Registered: Aug 2003
Location: Sydney Australia
Distribution: CentOS/archlinux
Posts: 40

Rep: Reputation: 16
mass chown

Here is two commands I find usefull to change the owner/permissions on many files at the same time.
To change all files and not dirs:
root@slacker htdocs]# chmod 644 `find . -type f`
and to change all dirs and not files:
root@slacker htdocs]# chmod 755 `find . -type d`

You can replace the chmod with chown commands. please note: the find . -type f is enclosed in backticks `


Cheers
Mick
( lunix )

----------------------------------------------------
If you have found this usefull then please
click on the the affero button below and
take the time to rate my help.

Last edited by loonix; 11-02-2003 at 08:20 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Permissions jong357 Linux - General 5 01-25-2005 02:39 PM
changing permissions... ashesh Linux - General 3 08-15-2003 11:32 PM
Changing permissions Mladek Linux - Software 7 07-09-2003 08:57 AM
Changing Permissions linuxfond Linux - Newbie 11 07-01-2003 02:48 PM
Permissions Changing ew2003 Linux - Newbie 1 04-29-2003 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration