Changing permissions for all subdirectories and files

  • vish64
  • Novice
  • Novice
  • vish64
  • Posts: 23
  • Loc: USA

Post 3+ Months Ago

Hi,

If I am the root user, how would I give a user access to all files and folders in a certain directory?

I tried chmod 'xxx' , but even with using 777, it only changes the directory permissions & not the files within it. Do i have to manually change permissions on every file ? whats the quickest way ?

Thanks
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

vish64 wrote:
Hi,

If I am the root user, how would I give a user access to all files and folders in a certain directory?

I tried chmod 'xxx' , but even with using 777, it only changes the directory permissions & not the files within it. Do i have to manually change permissions on every file ? whats the quickest way ?

Thanks


Quickest?
chmod -R 777 dir_name/

Although, arbitrarily doing that is "bad" (TM). Giving everyone permissions to read, write and execute is NOT a good thing.

However, you did ask which was the quickest method, not the most appropriate.

BTW, should you have this sort of question regarding unix commands, try
man <unix_command> as in ;
man chmod

It will provide you with the manual page for that particular command.

Cheers.
  • Uncensored-Hosting
  • Proficient
  • Proficient
  • User avatar
  • Posts: 383
  • Loc: Los Angeles

Post 3+ Months Ago

Daemonguy is correct the -R makes it recursive and will affect all the files in the directory.
  • mindcry
  • Novice
  • Novice
  • mindcry
  • Posts: 34

Post 3+ Months Ago

If you want to just get directories try chmod -R 777 */
  • RGVsDigitalPimp
  • Born
  • Born
  • RGVsDigitalPimp
  • Posts: 2

Post 3+ Months Ago

Hey guys. Im a newbie with this Linux stuff but our Novell webserver crashed (hard drive) and thought to put Novells version (SUSE 10.0) instead. We have the root folder for our website at /etc/apache2/htdocs

We chmodded that folder and all subdirectories with you alls commads that you posted on here and seemed to work. I go in there, create a new folder in the root (i.e http://www.psja.k12.tx.us/purch) and when i try to access /purch on the site it says FORBIDDEN PERMISSION ERROR. I then have to chmod THAT folder to view it. Why do I have to chmod ALL folders one by one as i create them when i chmodded the root and all files and directories in there? Any ideas guys? Thanks in advance guys.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

It's called the umask.

Type
Code: [ Select ]
man umask
  • RGVsDigitalPimp
  • Born
  • Born
  • RGVsDigitalPimp
  • Posts: 2

Post 3+ Months Ago

Thanks for the quick reply but . . I think I got even more confused. Haha . . inversed numbers and all that with the umask command. I read the man umask and searched the net for umask explanations and found some but confused the heck out of me. We tried some umask commands that seemed to work but still getting permission denied forbidden errors. Hmmmm
  • Intruder BG
  • Newbie
  • Newbie
  • Intruder BG
  • Posts: 13
  • Loc: Belgrade - City of Paviljoni

Post 3+ Months Ago

I think it`s better to use .htaccess file to setting up permissions and lot`s of more stuff about your own site...
  • CodyRo
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: California

Post 3+ Months Ago

.htaccess is an apache function that will only affect people visiting the website, not the users on the machine.
  • Intruder BG
  • Newbie
  • Newbie
  • Intruder BG
  • Posts: 13
  • Loc: Belgrade - City of Paviljoni

Post 3+ Months Ago

CodyRo wrote:
.htaccess is an apache function that will only affect people visiting the website, not the users on the machine.


Yeah sorry, I thought that he want to change permissions for website visitors :S My mistake...
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

RGVsDigitalPimp wrote:
Thanks for the quick reply but . . I think I got even more confused. Haha . . inversed numbers and all that with the umask command. I read the man umask and searched the net for umask explanations and found some but confused the heck out of me. We tried some umask commands that seemed to work but still getting permission denied forbidden errors. Hmmmm


I'm really not certain where the disconnect is regarding umask operations. It's merely an exclusive OR operation.

In Unix all base permissions begin as the following;
Directories [ Octal 777 / Binary 111111111 ]
Files [ Octal 666 / Binary 110110110 ]

Apply your umask as exclusive OR to any file created;

Umask = 022 (let's just say)

Create a new file named new.txt (touch new.txt).

It should be set with the following perms (barring the use of acl's and the like);

666 ^ 022 = 644, or 110110110 ^ 000010010 = 110100100,
Net result; rw-r--r--
  • PsyckBoy
  • Graduate
  • Graduate
  • PsyckBoy
  • Posts: 204
  • Loc: SoCal

Post 3+ Months Ago

Quote:
110110110 ^ 000010010 = 110010010


110110110 ^ 000010010 = 110100100
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Good catch. Must have been a typo on my part. How embarrassing.
  • PsyckBoy
  • Graduate
  • Graduate
  • PsyckBoy
  • Posts: 204
  • Loc: SoCal

Post 3+ Months Ago

All those ones and zeros can start to run together
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Yeah but I am usually quite anal about that sort of thing. Sigh.

Post Information

  • Total Posts in this topic: 15 posts
  • Users browsing this forum: No registered users and 16 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.