Can't share docs between 2 users with common directory

Questions about applications and software
Forum rules
Before you post please read this

Can't share docs between 2 users with common directory

Postby roccop on Sun Jan 27, 2013 6:28 am

Hello,
I'm using Linux Mint14 -64.
I have two users: rocco (main) and ospite (guest)
I shared /home/rocco/Pubblici (in english ->/home/rocco/Public)
rocco and ospite are using this directory and I want they can edit, write, read and delete everything inside.
After my modifications the 2 users can't edit not propetary files.
How can I solve my problem?

My idea is: ospite (in english guest) can use my PC just only for internet and can read, write and download file only in one directory shared with rocco.
(ospite must not have permissions to look other directories of my PC)

Some output:

Code: Select all
cat /etc/passwd
rocco:x:1000:1000:Rocco,,,:/home/rocco:/bin/bash
ospite:x:1001:1001:Ospite,,,,:/home/ospite:/bin/bash


Code: Select all
ls -l /home/rocco
drwxrwxrwx 2 rocco rocco-ospite 4096 gen 25 21:57 Pubblici


Code: Select all
ls -l /home/rocco/Pubblici/
-rw-r--r-- 1 ospite ospite 12 gen 22 21:26 file_ospite
-rw-r--r-- 1 rocco  rocco  21 gen 22 21:17 file_rocco


Code: Select all
cat /etc/group
rocco:x:1000:rocco
ospite:x:1001:ospite
rocco-ospite:x:1002:ospite,rocco
roccop
Level 1
Level 1
 
Posts: 16
Joined: Mon Jul 30, 2012 11:04 am

Linux Mint is funded by ads and donations.
 

Re: Can't share docs between 2 users with common directory

Postby bjornmu on Sun Jan 27, 2013 8:26 am

This is a bit tricky. First you need to ensure all new files in this directory get a group id of rocco-ospite, you can do this with:
Code: Select all
chmod g+s Pubblici

Note this will not change existing files.

But for both users to be able to edit files created by the other, you have to change the "umask". Since you have only those two users you can edit the global default setting in the file /etc/login.defs . Find the line with UMASK and change 022 to 002. You need to be superuser to do this:
Code: Select all
sudo gedit /etc/login.defs

Or whatever editor you use. Be careful! This will not take effect until next time you log in. NB this will cause *all* files created by the users to be group writable which is not generally recommended, but as long as ospite is not member of rocco's default group, it will not be able to access your other files.
User avatar
bjornmu
Level 3
Level 3
 
Posts: 154
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: Can't share docs between 2 users with common directory

Postby altair4 on Sun Jan 27, 2013 11:06 am

Creating a shared directory is easy enough using either the setgid method that bjornmu suggested or by using bindfs but that doesn't solve the other requirement:
(ospite must not have permissions to look other directories of my PC)

You can isolate your own home directory from ospite:
Code: Select all
chmod 0770 /home/rocco

But ospite will have read access to almost everything else on your system.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5842
Joined: Tue Feb 03, 2009 10:27 am


Return to Software & Applications

Who is online

Users browsing this forum: Antban, Oscar799, richard-g8jvm and 18 guests