LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2011, 07:37 PM   #1
stratotak
Member
 
Registered: Sep 2005
Distribution: Today Debian . Tomorrow ..??
Posts: 386

Rep: Reputation: 39
Changing folder permissions and its sub folder and files?


I need to change permission of a folder with sub folder and files in those subfolders to stream video and mp3's to my PS2 .I can right click each folder and sub folder and then each file in that folder to change permission but is there a quick command to to change permission on the main folder and all sub folders and files change.I need to change the permission in "Other" from none to read so the PS2 can read the files.When I right click and change permission in the main folder it doesnt change permission in subfolders.
 
Old 12-27-2011, 07:58 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
have you read the chmod man page ?
Code:
man chmod 
--- then ---
su -
cd location/of/the/folder
chmod -R ??? folder
replace the ??? ( or ???? ) with the values
--- or ---
chown
Code:
man chown 
------------
su -
cd  location/of/the/folder

chown -R User:group folder
 
Old 12-27-2011, 08:12 PM   #3
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Following on from the above instead of using values like 655 you can do "chmod -R a+r <foldername>".
 
Old 12-27-2011, 10:35 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I would use the find command to locate all files, and another to locate directories. You need `x' set for directories, but don't want it set for non-executable files.

find dir/ -exec chown user.group '{}' \;
find dir/ -type d -exec chmod 0755 \;
find dir/ -type f -exec chmod 0644 \;

You need to run chown as root, and chmod as root if you own the file.
 
1 members found this post helpful.
Old 12-28-2011, 06:55 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I'd like to add one small modification to jschiwal's find commands. Change the final "\;" at the end to "\+". The first pattern executes a separate command for each file, but the second runs them in xargs-like batch mode...launching only the minimum number of processes needed to handle the whole file list.


( Be aware though that "\+" only works for commands that are capable of handling multiple files as input, and only if they can be positioned at the end of the argument list. )
 
Old 12-29-2011, 01:55 AM   #6
singhjc
Member
 
Registered: Nov 2010
Location: Moradabad
Distribution: Redhat,Centos
Posts: 31

Rep: Reputation: 1
Hi,


Use simple chmod ??? -R folder name

4= read
2= write
1= execute

for example

chmod 777 -R foldername

here every one have full permission for read write and execute
 
Old 12-29-2011, 05:11 AM   #7
kuldip acharya
LQ Newbie
 
Registered: Dec 2011
Posts: 5

Rep: Reputation: Disabled
$ chmod 0777 foldername
 
  


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 permissions of a folder knobby67 Linux - Software 5 10-04-2009 08:13 AM
Changing permissions of folder and subdirectories esc_5p1d0r Linux - Newbie 4 01-13-2007 02:39 PM
Changing Permissions in Win98 Folder brianZA Red Hat 3 01-03-2007 02:33 AM
Changing Permissions on Root Folder acascianelli Linux - General 1 08-04-2006 03:28 PM
Having problems changing permissions on a folder zener Linux - Security 16 12-19-2005 09:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02: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