Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-28-2014, 04:26 PM   #1
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 264

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


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:
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, 04:31 PM   #2
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,467
Blog Entries: 6

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
man chmod:

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

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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, 09:25 PM   #4
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 264

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.


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

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration