Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Once again I have a very easy linux question that I cannot solve
I have a folder called Shared at /home/shared. The system in question has 5 users. I need each of these users to read/write/edit and create files this folder.
To achieve this I created a seperate group called "people" which every user belongs to . The /home/shared folder was then set up with people as its owner and group. I then placed a link to this folder in everyones home folder.
People can access this folder. However if a single user writes a file to inside folder it gets there user permisisons. This means that others users cannot edit it.
I can only solve this problem by using konquerer and right clicking on the /home/shared folder and selcting apply "changes to subdirectories". It then goes down the branch and changes the files permission to the people group in both terms of owner and group.
I am thinking that I need to insert a "chmod" command into my startup script so when each user logs on this is done automatically.
Question is what would the command be and where script could I place it in?
I hope this makes sense. I at least hope someone can figure out what I am trying to do!
Unfortunatley I dont have access to this machine at the moment but will later. I'm remembering the problem from about a week or two ago. Forgive me if it doesn't make sense!
You could put a script in each users .bash_profile but that would only be read when someone logged in. You may be better writing a cron job that recursively sets the permissions on the files every five minutes etc:
chown -R people /home/shared/*
chgrp -R people /home/shared/*
chgrp -R 660 /home/shared/*
It's a bit tricky ... the "proper" way from a security
point of view would be the cron job suggested above,
with the odd chance of someone trying to edit a
file that was written by someone else before cron
hit it ...
If you take good care of the subdirectory trees
permissions of the individual group members so
they can't list each others home for reading and
make their work-folders so they have different
names that are unknown to each other, you
could make people the default group for all
of them and change their umask to 002...
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602
Rep:
If you set the sticky bit on the directory all files written to the directory will be owned to the same group as the directory. Proper umasks will do the rest.
This sets the owner status of the files in this directory as YP which is a group everyone belongs to.
Also the group is set to "user"s which everyone belongs to.
However this works fine except one thing.
Some people can save files to the shared folder which other people cannot change the privelgies for.
For example I can log on as admin. This is an account which I use to adminsiter the computer. If I save a file into the shared folder during this session and log out it stays as having "admin "for owner and "admin" for group.
If some one else log in for example the "yp" account. When the script is run files cannot be changed as their is insufficent priveliges.
I think that the above script would be best run as root user which would solve the problem
I also tried putting the above inside the .bash_logout file which would solve the problem but this didn't work.
Originally posted by david_ross You could put a script in each users .bash_profile but that would only be read when someone logged in. You may be better writing a cron job that recursively sets the permissions on the files every five minutes etc:
chown -R people /home/shared/*
chgrp -R people /home/shared/*
chgrp -R 660 /home/shared/*
Like I said before - put it in a script that is run as root by cron.
Ok I am going to admit it! I don't know what a sticky bit is or a umask or how to use them! I guess that might be the reason I choose the other method <grin>
Same with the cron job... <bigger grin>
I know I really should know this but I am an idiot! I guess I need to go away and look up sticky bits and umasks... and maybe cron for the 'other' method... unless anyone here wants to enlighten me
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.