I know how change permissions and owners on files and folders .
But this is applies to files and folders that's already there . So you have to fix such things after the fact.
I want a folder where new files and folders that are added get a specific set of permissions regardless of what the app that created it was ( or which user was running it )
Results 1 to 6 of 6
-
2012-05-22, 19:15 #1
Preset file and folder permissions
--------------------------------------------------------------------
Main hifi: Touch + CIA PS +MeridianG68J MeridianHD621 MeridianG98DH 2 x MeridianDSP5200 MeridianDSP5200HC 2 xMeridianDSP3100 +Rel Stadium 3 sub.
Bedroom/Office: Boom
Kitchen: Touch + powered Fostex PM0.4
Misc use: Radio (with battery)
iPad1 with iPengHD & SqueezePad
(in storage SB3, reciever ,controller )
server HP proliant micro server N36L with ClearOS Linux
http://people.xiph.org/~xiphmont/demo/neil-young.html
-
2012-05-22, 19:30 #2
It sounds as if umask is what you're looking for. Here is one reference for it, I'm sure you can turn up a lot more on the 'net.
http://www.cyberciti.biz/tips/unders...lue-usage.html
-
2012-05-22, 21:35 #3
Umask seems useful . Thank you

But it is set per user and not per folder .
The tricky part is that I want every file created in a certain directory have a set of permissions .
A file created elsewhere should be created with the usual permissions .
I'll investigate more...--------------------------------------------------------------------
Main hifi: Touch + CIA PS +MeridianG68J MeridianHD621 MeridianG98DH 2 x MeridianDSP5200 MeridianDSP5200HC 2 xMeridianDSP3100 +Rel Stadium 3 sub.
Bedroom/Office: Boom
Kitchen: Touch + powered Fostex PM0.4
Misc use: Radio (with battery)
iPad1 with iPengHD & SqueezePad
(in storage SB3, reciever ,controller )
server HP proliant micro server N36L with ClearOS Linux
http://people.xiph.org/~xiphmont/demo/neil-young.html
-
2012-05-23, 03:49 #4
Hmm, that is tougher. Is this in a desktop environment? Because if it were a remote CIFS/SMB environment then I think Samba allows you to set the umask for different shares. But when you're accessing the directory directly I'm not sure how you would force different default permissions.
-
2012-05-24, 04:57 #5Senior Member
- Join Date
- Apr 2008
- Location
- Paris, France
- Posts
- 1,466
Depending on what you want to achieve you might be happy with a directory with the sticky bit set, or with a bind mount if the underlying fs allows options such as umask= or uid=. There is a FUSE module called bindfs that seems to allow specifying owner and rights.
If you have interest in exporting the dir outside the machine, then as Aubuti said Samba will help. NFS will do that too. (I suppose you can use NFS/Samba within the localhost… never tried that
In any case, I think you solution would probably include creating an extra group and/or user. Usually when you can't get the authorizations right, it's because groups need some mending.
(Brute force can help as well. I've sometimes used a script activated via the automounter or some other application to execute some random task before mounting a share. A cron job will fix anything, in time.)4 SB 3 • iPeng (iPhone + iPad) • SqueezeLite • Squeezebox Server 7.6.2 (Debian 6.0) with plugins: CD Player, WaveInput by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • Just Covers by Tom Kalmijn • WeatherTime by Martin Rehfeld • Local Player, BBC iPlayer, SwitchPlayer by Triode • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.
-
2012-05-30, 22:36 #6
A simple one-time chown and chmod will do most of what you want.
Example: you want user 'fred' to be able to control all files created by any user in /tmp/bedrock and and subdirectories there of.
Logged in as user barney:
So, you can see by setting the 'sticky bit' and the UID & GID with the initial chmod 7777 on fred owned /tmp/bedrock, any subsequent files or directories created will be read/write/execute/delete-able by fred. The files created by user barney were owned by barney, but they belonged to the fred group. Thus fred could do anything he pleased with the files.Code:sudo mkdir /tmp/bedrock sudo chown fred:fred /tmp/bedrock sudo chmod 7777 /tmp/bedrock cd /tmp ls -l #drwsrwsrwt 2 fred fred 4096 May 30 22:55 bedrock cd bedrock touch dino ls -l dino #-rw-rw-r-- 1 barney fred 0 May 30 23:02 dino mkdir 'stone quarry' ls -l 'stone quarry' #drwxrwsr-x 2 barney fred 4096 May 30 23:07 stone quarry cd 'stone quarry' touch rocks ls -l rocks #drwxrwsr-x 2 barney fred 4096 May 30 23:07 rocks mkdir "../fred's house" cd "../fred's house" touch wilma ls -l wilma #-rw-rw-r-- 1 barney fred 0 May 30 23:09 wilma cd /tmp rm -R -f ./bedrock #rm: cannot remove `bedrock': Operation not permitted sudo -u fred rm -R -f ./bedrock ls -l #ls: cannot access ./bedrock: No such file or directory

Reply With Quote

