LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2018, 09:41 AM   #1
chickenminnie
LQ Newbie
 
Registered: Jan 2005
Location: ALbany, NY
Distribution: SLES
Posts: 13

Rep: Reputation: 0
Oddball permissions scenario


I have a home volume with fifty or so home directories in it which each corresponding user can write to as you would expect. I need to give one user (DATA) the ability to write to each of these directories; would this best be accomplished by giving DATA its own group and allowing DATA's group write access to these folders? Am I over-thinking this?

Thanks,

M
 
Old 06-18-2018, 10:14 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
If you want to stay out of the way of the regular users' use of the directoris then ACLs are probably the best way even if they are a bit confusing.

Otherwise you can use the group permissions.
 
Old 06-18-2018, 07:33 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by chickenminnie View Post
I have a home volume with fifty or so home directories in it which each corresponding user can write to as you would expect. I need to give one user (DATA) the ability to write to each of these directories; would this best be accomplished by giving DATA its own group and
You are not overthinking this and basically it is correct. You would need to set the group ownership of all home directories to data. And then, make all directories group writable.

You can create a new user data, belonging to the data group. He will have write access to all home directories. You don't need to create that user data, you can add any user to the data group.

A slight problem is that ordinary users do not belong to the data group. If they would, everyone would have wrote access to all home directories. But if they are not member of the data group the newly created files do not have group ownership by data and cannot be written by the data group.

In order to make sure every file created in that directory has data groupid, you should set the sticky bit on the user's directory.
Code:
chmod g+s /home/myuser
jlinkels
 
Old 06-18-2018, 09:58 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I thought home directories had to be owned by the user.
 
Old 06-18-2018, 10:17 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
A couple of thoughts here:
First, should all files be group writable by DATA?...or only those files DATA writes?
If the latter, I disagree with jlinkels...don't set the sticky bit for group DATA...
Otherwise, their advice looks sound...
But...
How will the "ordinary user" be able to read files created by the DATA user? Do they even need to?
or...more to the point...
What exactly are you trying to accomplish? [This is known as the "Tim D. Memorial Question" where I came from. ]

Why does the user DATA need to write to other user's directories ?

Quote:
Originally Posted by AwesomeMachine View Post
I thought home directories had to be owned by the user.
I don't see that anyone is proposing a change in the ownership of the user's home directories...

Last edited by scasey; 06-18-2018 at 10:25 PM.
 
Old 06-19-2018, 04:27 AM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
The user directories and files remain owned by the user. Group is set to data. Directories and files must be group writable.

jlinkels
 
1 members found this post helpful.
Old 06-19-2018, 08:04 AM   #7
chickenminnie
LQ Newbie
 
Registered: Jan 2005
Location: ALbany, NY
Distribution: SLES
Posts: 13

Original Poster
Rep: Reputation: 0
This is exactly what I was trying to accomplish, thank you.
Quote:
Originally Posted by jlinkels View Post
The user directories and files remain owned by the user. Group is set to data. Directories and files must be group writable.

jlinkels
This box acts as a file hub of sorts for a bunch of ETL processes and one of our remote technicians discovered that he could traverse the directories in /home which isn't a good idea.

Thanks everyone!
 
Old 06-19-2018, 08:08 AM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Post Owning user not a member of owning group

Quote:
Originally Posted by jlinkels View Post
You would need to set the group ownership of all home directories to data. And then, make all directories group writable.

You can create a new user data, belonging to the data group. A slight problem is that ordinary users do not belong to the data group. If they would, everyone would have wrote access to all home directories.

So, that means ownership would need to be user:group where 'user' is not a member of 'group'? Can you do that?
 
Old 06-19-2018, 11:54 AM   #9
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by AwesomeMachine View Post
So, that means ownership would need to be user:group where 'user' is not a member of 'group'? Can you do that?
Yes, that is perfectly possible. Look at this example. gemerenciana is not member of the adm group. Still she is able to create files which belong to the adm group. The next problem is that she has a umask of 022. Which should be changed to 002 if files must be group writable. The setgid only makes the group ownership stick.

The idea behind this is that a user co-operating to a project would make his files group writable. Either automatically by changing the umask. Or on purpose to give his group members access.

If you realize how Unix was designed, for which purpose and that the world was not as evil as it is now, it makes perfect sense.

Directory:
Code:
drwxrwsr-x 2 gemerenciana adm   4096 Jun 19 16:43 gemerenciana
Create a file
Code:
gemerenciana@homeservII:/tmp/gemerenciana$ touch weg2
gemerenciana@homeservII:/tmp/gemerenciana$ ll
total 0
-rw-r--r-- 1 gemerenciana adm 0 Jun 19 16:43 weg
-rw-r--r-- 1 gemerenciana adm 0 Jun 19 16:45 weg2
Group membership:
Code:
gemerenciana@homeservII:/tmp/gemerenciana$ groups
users audio scanner family lspec gemerenciana
Owner changes the group permissions while she is not member of that group:
Code:
gemerenciana@homeservII:/tmp/gemerenciana$ chmod g+w weg*
gemerenciana@homeservII:/tmp/gemerenciana$ ll
total 0
-rw-rw-r-- 1 gemerenciana adm 0 Jun 19 16:43 weg
-rw-rw-r-- 1 gemerenciana adm 0 Jun 19 16:45 weg2

jlinkels

Last edited by jlinkels; 06-19-2018 at 12:00 PM.
 
1 members found this post helpful.
  


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
Is this scenario conceivable? Completely Clueless Linux - Security 6 12-08-2014 06:02 PM
Theoretical scenario ouikoto Linux - Newbie 1 03-13-2013 04:24 PM
Scenario detortech Linux - Newbie 11 04-18-2012 12:07 PM
Oddball Samba Error in Slackware Current Woodsman Slackware 4 10-28-2008 09:41 PM
Oddball kernel compile problem(unexplainable)... Flecko Slackware 14 09-13-2003 12:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:02 AM.

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