User and Group Access to Folders
I've just been reading about user and group access to folders, but am having a problem understanding a couple of things.
When in Windows, you can assign multiple user and group permission to a file/folder, plus you can allow permissions to propagate through a folders contents. Can I do this in Linux? From what I can see, I can only assign a single user to a folder/file, but can assign multiple groups. The only way I can see around the first problem is to assign each user their own group, thereby allowing me to provide access based on individual users. Is that the only way to do it, and can you nest groups within groups? The seconds problem worries me even more. If I set permissions to a folder, are the permissions propagated through the folders contents, including newly added files? From what I've read, I have to individually assign access right to each file as it appears. This must be incorrect, as it sounds crazy. Is it correct and do permissions propagate through folder contents? Thanks |
If you do an
Code:
ls -l Code:
drwxr-xr-x d for directory or - for a file rwx permissons for the owner(user) of the file First r-x permissions for the group of the file Second r-x permissions for everyone else If change permissions just for a directory, no it's permissions do not propogate down the directory tree. Then, since everything is under the root directory, everything would be owned by root! But if you want to change ownership on a directory and every thing under it, there is an option to the chmod command Code:
chmod -R user directory Code:
chmod -R user:group directory Code:
chown :group directory/file Code:
chgrp file |
Thanks darthtux. So if I wanted to assign full access to group1, group2, user1 and user2, the only way to do it would be to create a new group and place all the users from group1 and group2, plus user1 and user2 into it? Have I got that correct, it sounds a nightmare to administer?
|
I just did a test assigning 777 -R to a directory. Everything within the it went to 777, but when I copied a file, the file had permission 755. Is there any way to make the copied file take 777 as it's permission?
|
If you copy a file that has permissions 755 it will not automatically take permissions 777. You could write a little script like:
#!/bin/bash cp $1 $2 chown 777 $2/$1 Name it something like "cpperm" and put it in a directory in your PATH. Then on the command line: cpperm file directory This puts file in directory and changes its permissions to 777 |
Whoops! I made a small mistake. That should have been
Code:
#!/bin/bash |
All times are GMT -5. The time now is 08:21 PM. |