Hi LQ users!
I have just set up our home pc with opensuse 11.2 (Awesome!) for shared use between my wife and myself. I have a vague idea how to solve my problem, however I'm certain there are more elegant ways out there..
I would like to share the following folders in my home directory with my wife:
/home/spacemonkey/Pictures
/home/spacemonkey/Music
/home/spacemonkey/Videos
The idea is that we both (and nobody else, not even other members of "users") have access to read, write and excecute these... I have created a new group called "private_users" and added our users to this group...and did the following to the above directories:
Code:
chown -R spacemonkey:private_users <target_dir>
chmod -R 770 <target_dir>
I have created symbolic links in the home folder of my wife to the above directories (as Pictures, Music, Videos) with the following:
Code:
ln -s /home/spacemonkey/Pictures/ Pictures
ln -s /home/spacemonkey/Music/ Music
ln -s /home/spacemonkey/Videos/ Videos
This almost works.. we can read, write and execute all the existing files in these directories, however when we create new files they inherit the default privileges e.g.:
Code:
ls -l
-rw-r--r-- 1 spacemonkey users 2 2010-01-14 22:56 foo
so the other user (eg my wife) will not be able to modify or delete (or excecute)this file...
How do I fix this?
I think that a solution would be to create the following script:
Code:
#!/bin/bash
cd /home/spacemonkey
chown -R spacemonkey:private_users Pictures
chmod -R 770 Pictures
chown -R spacemonkey:private_users Music
chmod -R 770 Music
chown -R spacemonkey:private_users Videos
chmod -R 770 Videos
and then to execute this script with cron every 2 hours or so... I do not actually know how to use cron yet.. Any advice is welcome..
I believe that there must be a much simpler and more elegant solution to this...
Is it possible to make the privileges of the directories persistent and recursive?
Is there a different way of achieving the same?
Thanks for taking the time to read my long post!
br