Jump to content

How do I make a share directory?


mtweidmann
 Share

Recommended Posts

Hi,

 

I've made a dirctory called /home/shares, and also created a group called shares (gid=500). The idea was that anything in the shares folder would belong to shares, and accessable by any users in the shares group. So I'd have an area for sharing some files, between certain user accounts.

 

I want to set it up so that ALL the files that are in /home/shares ALWAYS belong to shares. So if root were to create a file the directory it would automatically belong to shares, so that other members of the group could alos read/write the file. At the moment I just manually change the files permission as I have to. Does anyone know of a command/script/etc that would do this ofr me?

Link to comment
Share on other sites

a search in freshmeat reveals dnotify. its description states

dnotify is a simple program that makes it possible to execute a command every time the contents of a specific directory change in Linux. It is run from the command line and takes two arguments: one or more directories to monitor and a command to execute whenever a directory has changed. Options control what events to trigger on: when a file was read in the directory, when one was created/deleted, etc.
so im thinking you can set this and create a script that changes all group ownership of the directory to share and what not.

 

you could get away with setting a share user and then swoop the files with chown -rf share.share /home/shares (check the command. my cli memory is getting rusty), or you can ask the bash nuts in this board for something more fancy.

 

ciao!

Link to comment
Share on other sites

Cool! This "dnotify" thing seems to be interesting. Indeed, it could be made to execute:

chgrp -R shares /home/shares

provided all shares' users have a umask of 002, and that dnotify is run by root or an ID belonging to shares.

Another solution is to create a FAT32 partition, mount it under /home/shares with uid=0,gid=<shares' gid>.

 

Yves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...