The officially official Devuan Forum!

You are not logged in.

#1 2022-04-18 09:21:25

SpongeBOB
Member
From: Brussels
Registered: 2022-02-07
Posts: 47  

[SOLVED] Sharing files between users with stickybit and setgid

Hi everyone,

I would like to share files between users ( /home/tester )

I would like that only members of the group tester have access to that folder and can only delete their files

I've tried the following

su

groupadd tester
useradd -m -c "John Doe" John
passwd John

usermod -aG tester John
usermod -aG tester Marie

mkdir /home/tester
cd /home/tester

chown :tester .
chmod +t .
chmod -R g+s .
setfacl -Rm g:tester:rwx,d:g:tester;rwx .

so John and Marie have access to /home/tester they can create files, read the files of the others, but can't edit files from others.. any ideas ?

su

getfacl /home/tester/by_john.txt

# file: home/tester/by_John.txt
# owner: John
# group: tester
user::rw-
group::r-x			#effective:r--
group:tester:rwx		#effective:rw-
mask::rw-
other::---

Last edited by SpongeBOB (2022-04-19 11:59:48)


Linux noob, plz be kind big_smile

Offline

#2 2022-04-18 12:34:41

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,326  

Re: [SOLVED] Sharing files between users with stickybit and setgid


To obtain a root shell use su -. Using just su will result in "command not found" messages.

Offline

#3 2022-04-19 11:00:25

SpongeBOB
Member
From: Brussels
Registered: 2022-02-07
Posts: 47  

Re: [SOLVED] Sharing files between users with stickybit and setgid

Thanks HOAS, I don't understand I beleive my commands cover whats in that link..

btw Marie & John are both in the tester group

cat /etc/group | grep tester
tester:x:1001:John,marie

and the file created by John has it GID as tester

getfacl /home/tester/by_john.txt

# file: home/tester/by_John.txt
# owner: John
# group: tester
user::rw-
group::r-x			#effective:r--
group:tester:rwx		#effective:rw-
mask::rw-
other::---

and we can see --> group:tester:rwx
So why marie that part of tester can't delete/modify it ?

Additionnaly ls -l on the /home/tester give:

drwxrws--T+  2 root    tester  4.0K Apr 18 11:17 tester

As it should be, right ?

Last edited by SpongeBOB (2022-04-19 11:25:05)


Linux noob, plz be kind big_smile

Offline

#4 2022-04-19 12:03:02

SpongeBOB
Member
From: Brussels
Registered: 2022-02-07
Posts: 47  

Re: [SOLVED] Sharing files between users with stickybit and setgid

ooh I think I see what going on, The sticky bit prevent everyone else than the owner of the file to delete it, so therefor edit it too hmm


Linux noob, plz be kind big_smile

Offline

#5 2022-04-19 13:51:46

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,326  

Re: [SOLVED] Sharing files between users with stickybit and setgid

Here's how the file should look:

$ getfacl /home/test/empty
getfacl: Removing leading '/' from absolute path names
# file: home/test/empty
# owner: empty
# group: test
user::rw-
group::r--
other::r--

$

^ That was after following the linked guide and any user in the test group can delete (but not modify) /home/test/empty. The sequence you have posted does not match the content of my provided link.


To obtain a root shell use su -. Using just su will result in "command not found" messages.

Offline

Board footer