LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-28-2014, 05:26 PM   #1
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 262

Rep: Reputation: 5
How do I change permissions entire drive(directory and sub directories and files)


Hello,

I'm having a little problem making my chmod command affect everything.

I have a LVM consisting of multiple drives that doesn't get wiped when I do a re-install of the base system.

I have been using chmod 777 in the past to give myself, the user, access to modify all of the files freely. Problem is when I do a reinstall I always have some files I cannot touch with the new system up and running. I always have to go into terminal and do an "su" or "sudo" to modify the files.

I can also chmod *** the files and then take control of them, but I have many files and don't want to have to do that to every one.

My question:
How can I include a reclusive command with chmod?

I have tried:
Code:
chmod 777 /directoryfromroot/*
but it doesn't change the files.

Is there a tag I can add to chmod to change all directories and files(present directory and under)?

Thank you.
 
Old 06-28-2014, 05:31 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997Reputation: 1997
man chmod:

Code:
       -R, --recursive
              change files and directories recursively
 
1 members found this post helpful.
Old 06-28-2014, 06:26 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Probably what's happening is that your user ID is getting changed accross system wipes/reinstalls. You could just change your user ID in /etc/passwd to be consistent or use a recursive chown (chown -R) to make the files owned by your new user. Setting gobs of stuff to 0777 has always struck me as a really bad idea (at least don't set the executable bit on non-executable files), particularly if there are any other users on the system or if it's connected to a network.
 
1 members found this post helpful.
Old 06-28-2014, 10:25 PM   #4
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 262

Original Poster
Rep: Reputation: 5
Thank you to astrogeek and btmiller.

Ha. That's kind of funny. I actually tried -r, but not -R. I need to get better at reading man pages. I tend to glance over them but miss what I need.

I've been using chmod 777 for everything, but realize it's not a good thing to do. It was just my home server so I wasn't very concerned with it. I am, however, starting to secure it and will start allowing files to only certain users (good practice also).

Thank you.
 
  


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
Automatically change permissions/ownership of files in a directory Shimdidly Linux - Newbie 3 04-08-2012 09:22 PM
change the permissions of files in a mounted drive sfeng Linux - Hardware 1 08-20-2011 10:52 AM
recursive file permissions does not change new files in same directory PAB Linux - Newbie 2 03-08-2004 01:27 PM
How do I change permissions of files/directories? Okashira Linux - Newbie 5 01-12-2004 06:11 PM
changing permissions for entire directory jmarsh Linux - Networking 2 05-13-2003 09:12 AM


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