LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 06: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, 07:53 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 770
Blog Entries: 3

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
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, 03:30 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,418

Rep: Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398
https://en.wikipedia.org/wiki/Recursion#Recursive_humor
 
Old 08-03-2016, 09:53 AM   #4
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: High Sierra
Posts: 8,664
Blog Entries: 17

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, 10: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, 12:20 PM   #6
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,204

Rep: Reputation: 244Reputation: 244Reputation: 244
A very dangerous command...
 
Old 08-04-2016, 04:27 PM   #7
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 601

Rep: Reputation: 280Reputation: 280Reputation: 280
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, 08:24 PM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,500

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

Rep: Reputation: 240Reputation: 240Reputation: 240
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 08:42 PM. Reason: ediy
 
Old 08-05-2016, 03:22 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,418

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


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 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 03:27 AM
chmod recursive on files on dlublink Linux - Newbie 6 03-02-2005 09:45 AM
recursive yet selective chmod bluefire Linux - General 6 10-22-2004 07:25 PM
chmod.....recursive help stateq2 Linux - General 3 03-28-2004 08:28 PM
Messed up recursive with chmod Cyth Linux - General 4 01-03-2003 01:16 PM

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

All times are GMT -5. The time now is 08:03 AM.

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