VI

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

add a comment
0

14 Answers

  • Votes
  • Oldest
  • Latest
DA

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.

add a comment
0

Daemonguy is correct the -R makes it recursive and will affect all the files in the directory.

add a comment
0
MI

If you want to just get directories try chmod -R 777 */

add a comment
0
RV

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 sub-directories with all the commands that you posted on here and seemed to work. I go in there, create a new folder in the root 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?

add a comment
0
DA

It's called the umask.

Type

man umask
add a comment
0
RV

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

add a comment
0
IB

I think its better to use .htaccess file to setting up permissions and lots of more stuff about your own site...

add a comment
0
CR

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

add a comment
0
IB

.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...

add a comment
0
DA

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--

add a comment
0
PB

110110110 ^ 000010010 = 110010010

110110110 ^ 000010010 = 110100100

add a comment
0
DA

Good catch. Must have been a typo on my part. How embarrassing.

add a comment
0
PB

All those ones and zeros can start to run together

add a comment
0
DA

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

add a comment
0