LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-02-2016, 05:50 AM   #1
ankit.singhal85
LQ Newbie
 
Registered: Aug 2016
Posts: 1

Rep: Reputation: Disabled
meaning of recursive in chmod command


what it the difference in between
chmod 777 * and, chmod -R 777 *
what does the recursive -R means here?
 
Old 08-02-2016, 06:53 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by ankit.singhal85 View Post
what it the difference in between
chmod 777 * and, chmod -R 777 *
what does the recursive -R means here?
Umm... I know that man pages sometimes can be hard to understand, but in this case it's right there in plain English:
Code:
       -R, --recursive
              change files and directories recursively
Recursion means that is changes all the files and directories in the current directory and all directories/files below.

Best regards,
HMW
 
Old 08-03-2016, 02:30 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
https://en.wikipedia.org/wiki/Recursion#Recursive_humor
 
Old 08-03-2016, 08:53 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by ankit.singhal85 View Post
chmod 777 * and, chmod -R 777 *
and it NEVER "fixed" anything. (apache permission denied errors,etc...)

It is my opinion that the question raises red flags.
Its use is immediately suspect.

Just my opinion.
 
2 members found this post helpful.
Old 08-03-2016, 09:01 AM   #5
dhrn
LQ Newbie
 
Registered: Apr 2016
Posts: 2

Rep: Reputation: Disabled
Chmod -R 777 directory/File

777-Giving Full permissions as READ , WRITE and EXECUTE to all users .
-R means recursive addition of permission to each file/directory which is mentioned .
 
Old 08-03-2016, 11:20 AM   #6
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
A very dangerous command...
 
Old 08-04-2016, 03:27 PM   #7
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,781

Rep: Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199
Dangerous also because chmod dereferences symbolic links.
Instead of
Code:
chmod -R 777 *
use
Code:
find * \( -type f -o -type d \) -exec chmod ugo+rwx {} +
And to remove the world-write permissions
Code:
find * \( -type f -o -type d \) -exec chmod o-w {} +
 
Old 08-04-2016, 07:24 PM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by chrism01 View Post
Sorry can you give me that link again?,
 
Old 08-04-2016, 07:40 PM   #9
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,149

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Post

Quote:
Originally Posted by ankit.singhal85 View Post
what it the difference in between
chmod 777 * and, chmod -R 777 *
what does the recursive -R means here?
Quote:
Definition of recursion
1
: return 1
2
: the determination of a succession of elements (as numbers or functions) by operation on one or more preceding elements according to a rule or formula involving a finite number of steps
3
: a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls itself one or more times until a specified condition is met at which time the rest of each repetition is processed from the last one called to the first — compare iteration
http://www.merriam-webster.com/dictionary/recursion

Go to Google play, check out this app. https://play.google.com/store/apps/d...obileKit&hl=en

Last edited by JJJCR; 08-04-2016 at 07:42 PM. Reason: ediy
 
Old 08-05-2016, 02:22 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
@Keith Hedger: I refer you to my previous ...
 
  


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
[SOLVED] Recursive chmod not working as it should scriptkiddy Linux - Newbie 9 03-10-2016 02:27 AM
chmod recursive on files on dlublink Linux - Newbie 6 03-02-2005 08:45 AM
recursive yet selective chmod bluefire Linux - General 6 10-22-2004 06:25 PM
chmod.....recursive help stateq2 Linux - General 3 03-28-2004 07:28 PM
Messed up recursive with chmod Cyth Linux - General 4 01-03-2003 12:16 PM

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

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