PDA

View Full Version : confused about permissions



dr j
7th May 2006, 09:16 AM
hi

i getting very confused about permissions on shared directories :confused:

i want 2 directories - one needs to be world read/writeable, the other needs to be world read only

the important thing is that files will not be created in these directories, rather they will simply be copied into them from users /home (all the files and folders in question will exist on a FC5 PDC/file server which serves 4 XP users on a LAN)

how do i set it such that all files/directories copied into my shared folders have the permissions of those directories and not of the original users ?

i have read about setuid, setgid and sticky bits but am getting confused - mostly because the discussions revolve around files created in, not copied to, the directories

thanks

ezzetabi
7th May 2006, 10:35 AM
A brute force (surely there is one better) solution is making a sh script that reset the ownership and the permissions everytime a new file is created...

dr j
7th May 2006, 11:00 AM
A brute force (surely there is one better) solution is making a sh script that reset the ownership and the permissions everytime a new file is created...


good point, hadn't thought of that...

not that i could actually write the script however ..... :rolleyes:

i agree though there has to be a more elegant way of doing this

ccrvic
7th May 2006, 11:07 AM
one needs to be world read/writeable

I seriously doubt this.


i have read about setuid, setgid and sticky bits but am getting confused - mostly because the discussions revolve around files created in, not copied to, the directories

What difference do you see between creating a file anew in a directory,. and copying it there?

Vic.

ezzetabi
7th May 2006, 11:25 AM
Untested, but should give a clue


#!/bin/bash
FOLDER='/foldername'

while test 1
sleep 170
find "$FOLDER" -mmin -3 -exec chown who:who {} \;
find "$FOLDER" -mmin -3 -type d -exec chmod 700 {} \;
find "$FOLDER" -mmin -3 -type f -exec chmod 600 {} \;
wend

dr j
7th May 2006, 12:02 PM
OK not 'world' read/writeable, rather 'all-user' read/writeable

as for create in vs copy - i haven't tried this yet, but various bits i have read make a specific distinction between data created in a folder - and in this case i know how to use setgid to force permissions - and copying into a folder - my specific problem

in any case unless there does turn out to be a nore 'elegant' way of doing this i'll play with the script and see how i get on

thanks