LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 06-18-2015, 02:32 PM   #1
davikes
LQ Newbie
 
Registered: Jun 2015
Posts: 5

Rep: Reputation: Disabled
Security more based off Group Permissions.


Could use some feedback. Was wondering what people's thoughts are setting up security more based off Groups in Linux. aka umask 707

I understand it wouldn't be "as secure" as file owner based but having files/folders default only being group accessible, then controlling access based on the group instead?

Thoughts, comments? good/bad.

Thanks
 
Old 06-18-2015, 03:21 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It is common to have files set so that both owner and group can access (007) but not common to try to prevent the owner from accessing. You'd have the owner in the same group as all the other users.

For more fine grained control you could use ACLs instead.
 
Old 06-18-2015, 03:35 PM   #3
davikes
LQ Newbie
 
Registered: Jun 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
The idea is they would need to be in the group to have access. So if there not, then they wouldn't. It would put you on as the sort of default "owner" of it, but permissions would be via the group.

If you take them out of the group but give them 007 then they still would have access to the file/folder via the owner permission.
 
Old 06-19-2015, 07:46 AM   #4
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
If the owner doesn't have permission for the file, then it doesn't matter what group(s) the owner is in, access to the file will be denied.

User (owner) permissions take precedence over group permissions. So, with umask 707, assuming directory permissions allow, users would be able to create files/directories, but then they couldn't access them because as the owner, they don't have permission.

For example, here's what happens when you create a file with umask 707:
Code:
$ umask 707
$ ls file
ls: cannot access file: No such file or directory
$ echo "this is a test" >file
$ ls -l file
----rw----. 1 sgrlscz sgrlscz 15 Jun 19 08:33 file
$ cat file
cat: file: Permission denied
$ echo "this is another test" >>file
bash: file: Permission denied
As you can see, I can create the file (because the directory allows me to), but I can't read it or write to again.
 
Old 06-19-2015, 08:24 AM   #5
davikes
LQ Newbie
 
Registered: Jun 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Good point, although, interesting behavior as you are in the group that has access.

Was curious is that configurable to the group first, then owner? Guessing not.

Last edited by davikes; 06-19-2015 at 08:28 AM.
 
Old 06-19-2015, 08:49 AM   #6
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
Quote:
Originally Posted by davikes View Post
Good point, although, interesting behavior as you are in the group that has access.

Was curious is that configurable to the group first, then owner? Guessing not.
No. It's the defined behaviour. First match determines access (i.e. an 'if..else if..else').

If you are the owner, your access is defined by the user permission only. If you're not the owner, then if you're in the group, your permission will be determined by group access only. Finally, if you are not the owner or in the group, your access is determined by the other permission.
 
Old 06-19-2015, 09:31 AM   #7
davikes
LQ Newbie
 
Registered: Jun 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Interesting so

----rw----. 1 testuser users 0 Jun 19 09:11 test2.txt
----rw----. 1 root users 0 Jun 19 08:23 test.txt

cat test.txt
test

cat test2.txt
cat: test2.txt: Permission denied

So you'd almost have to force the file to be owned by someone else really for that to work but there's no real way to do that?
 
Old 06-19-2015, 10:26 AM   #8
davikes
LQ Newbie
 
Registered: Jun 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
umask: 022

id testuser
uid=506(testuser) gid=100(users) groups=100(users)

-rw-r--r--. 1 root root 0 Jun 19 10:01 test1
-rw-r--r--. 1 root users 0 Jun 19 10:01 test2
-rw-r--r--. 1 testuser users 0 Jun 19 10:09 test3

echo "test1" > test1
-bash: test1: Permission denied
echo "test2" > test2
-bash: test2: Permission denied
echo "test3" > test3

cat test1
cat test2
cat test2
test3

----------------------

umask 007
touch test4

-rw-r--r--. 1 root root 0 Jun 19 10:01 test1
-rw-r--r--. 1 root users 5 Jun 19 10:04 test2
-rw-r--r--. 1 testuser users 6 Jun 19 10:13 test3
-rw-rw----. 1 testuser users 0 Jun 19 10:16 test4

echo "test4" > test4
cat test4
test4


--------------

Maybe umask 007 is more the answer? 002 would give read access to other/everyone.
 
  


Reply



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
Group permissions: user can't access 770 directory even though a member of group jm34003 Linux - Security 13 05-16-2012 02:03 PM
Secondary group users need to change the file permissions of primary group files? sunnybmv Linux - Newbie 3 12-10-2009 04:57 PM
permissions not recognizing group or assigned users to group blckspder Linux - Server 1 07-28-2008 10:32 AM
Samba Mystery: Users with Group permissions get denied based on Other. Emiro Linux - General 8 07-07-2008 10:25 AM
group permissions based on folder perms grcunningham Linux - Networking 1 05-27-2005 04:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:17 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
Open Source Consulting | Domain Registration