LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices



Reply
 
Search this Thread
Old 12-15-2004, 05:51 AM   #1
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
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
 
Old 12-15-2004, 06:05 AM   #2
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 45
If you do an
Code:
ls -l
you will note similar to the following
Code:
drwxr-xr-x
This can be broken down as
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
or you can change user and group ownership with
Code:
chmod -R user:group directory
You can't assign multiple groups but you can make a new group with the users you want in that group and then change group ownership of that file/directory with
Code:
chown :group directory/file
or
Code:
chgrp file
or recursively with the -R option

Last edited by darthtux; 12-15-2004 at 06:07 AM.
 
Old 12-15-2004, 06:15 AM   #3
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Original Poster
Rep: Reputation: 30
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?
 
Old 12-15-2004, 06:20 AM   #4
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Original Poster
Rep: Reputation: 30
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?
 
Old 12-19-2004, 05:07 AM   #5
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 45
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

Last edited by darthtux; 12-19-2004 at 05:09 AM.
 
Old 12-19-2004, 08:22 PM   #6
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 45
Whoops! I made a small mistake. That should have been

Code:
#!/bin/bash
cp $1 $2
chmod 777 $2/$1
 
  


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
User unability to access folders in GUI... Infernal211283 Linux - Newbie 8 02-18-2005 07:22 AM
normal user access folders jwijesundra Linux - Newbie 3 01-16-2005 11:46 AM
group access for specic folders in samba fidelis Linux - Networking 0 09-20-2004 04:20 AM
User Group for Restricting Internet Access kyleinc Linux - General 6 04-17-2004 06:49 AM
User and Group access restrictions? KendersPlace Linux - Security 1 08-20-2003 06:32 PM


All times are GMT -5. The time now is 07:20 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration