[opensuse] Default file permissions
Hi In SuSE 10.3, is there any way to set the default permissions for new files added into a directory? Currently, to maintain consistency, I have to wake the server up and change files added to a specific directory with 'chown root:users *'. Can this be automated? TIA John -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sunday 10 August 2008 00:50:22 John wrote:
Hi
In SuSE 10.3, is there any way to set the default permissions for new files added into a directory?
For file permissions and depending on how they are added, the umask might do the trick. File ownership is trickier.
Currently, to maintain consistency, I have to wake the server up and change files added to a specific directory with 'chown root:users *'. Can this be automated?
Sure. A cron job. Kurt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Kurt Wall pecked at the keyboard and wrote:
On Sunday 10 August 2008 00:50:22 John wrote:
Hi
In SuSE 10.3, is there any way to set the default permissions for new files added into a directory?
For file permissions and depending on how they are added, the umask might do the trick. File ownership is trickier.
Currently, to maintain consistency, I have to wake the server up and change files added to a specific directory with 'chown root:users *'. Can this be automated?
Sure. A cron job.
Kurt
By setting the perms and ownership (man chmod) The letters rwxXst select file mode bits for the affected users: read (r), write (w), execute (or search for directories) (x), execute/search only if the file is a directory or already has execute permission for some user (X), _set user or group ID on execution (s)_, restricted deletion flag or sticky bit (t). Instead of one or more of these letters, you can specify exactly one of the letters ugo: the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o). -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Thanks, Kurt. By 'Automated' I had intended to mean 'anything that falls into this directory automatically picks up root:users as its ownership'! However, if cron's the only way, then ... John Kurt Wall wrote:
On Sunday 10 August 2008 00:50:22 John wrote:
<snip>
Currently, to maintain consistency, I have to wake the server up and change files added to a specific directory with 'chown root:users *'. Can this be automated?
Sure. A cron job.
Kurt
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2008-08-10 16:31, John wrote:
Thanks, Kurt.
By 'Automated' I had intended to mean 'anything that falls into this directory automatically picks up root:users as its ownership'! However, if cron's the only way, then ...
John
See the "sticky bit" option of chmod. If you want more fine grained control, look into setfacl/getfacl, especially the Default ACL part. /Sylvester -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sun, 2008-08-10 at 15:31 +0100, John wrote:
Thanks, Kurt.
By 'Automated' I had intended to mean 'anything that falls into this directory automatically picks up root:users as its ownership'! However, if cron's the only way, then ...
Well technically, the ownership would still be whatever until cron ran it's scheduled job. If you want it to be owned by root and users group, then just create it as root? -- Michael S. Dunsavage -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Michael S. Dunsavage pecked at the keyboard and wrote:
On Sun, 2008-08-10 at 15:31 +0100, John wrote:
Thanks, Kurt.
By 'Automated' I had intended to mean 'anything that falls into this directory automatically picks up root:users as its ownership'! However, if cron's the only way, then ...
Well technically, the ownership would still be whatever until cron ran it's scheduled job.
If you want it to be owned by root and users group, then just create it as root?
By setting the owner/group (of the directory) _and_ setting the proper perms any file created by anyone in that directory becomes owned by the owner/group of the directory. -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Ken Schneider wrote:
By setting the owner/group (of the directory) _and_ setting the proper perms any file created by anyone in that directory becomes owned by the owner/group of the directory.
And how do I achieve this, please? My directories covered by this regime are already set to root:users but any new files put in them revert to root:root! J -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2008-08-11 12:26, John wrote:
Ken Schneider wrote:
By setting the owner/group (of the directory) _and_ setting the proper perms any file created by anyone in that directory becomes owned by the owner/group of the directory.
And how do I achieve this, please? My directories covered by this regime are already set to root:users but any new files put in them revert to root:root!
J
Again, use the sticky bit, or the default acl through setfacl #chown root.users <dirname> #chmod g+s <dirname> #touch <dirname>/test.file <dirname>/test.file will be owned by root.users /Sylvester -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Sylvester Lykkehus wrote:
On 2008-08-11 12:26, John wrote:
Ken Schneider wrote:
By setting the owner/group (of the directory) _and_ setting the proper perms any file created by anyone in that directory becomes owned by the owner/group of the directory.
And how do I achieve this, please? My directories covered by this regime are already set to root:users but any new files put in them revert to root:root!
J
Again, use the sticky bit, or the default acl through setfacl
#chown root.users <dirname> #chmod g+s <dirname> #touch <dirname>/test.file
<dirname>/test.file will be owned by root.users
/Sylvester Thanks, Sylvester! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Sylvester Lykkehus wrote:
On 2008-08-11 12:26, John wrote:
Ken Schneider wrote:
By setting the owner/group (of the directory) _and_ setting the proper perms any file created by anyone in that directory becomes owned by the owner/group of the directory.
And how do I achieve this, please? My directories covered by this regime are already set to root:users but any new files put in them revert to root:root!
J
Again, use the sticky bit, or the default acl through setfacl
#chown root.users <dirname> #chmod g+s <dirname> #touch <dirname>/test.file
<dirname>/test.file will be owned by root.users
/Sylvester
Hi Sylvester/Ken, Just to be correct, this is called SGID or set group ID. These advanced file perms with octal values followed by symbolic representation are: default mode example SUID 4000 -rwsr--r-- SGID 2000 -rwxr-sr-- Sticky bit 1000 drwxrwxrwt The lower case s and the lower case t represents an execute bit is set there. For the first example the file perms without the influence of the SUID is 744 but with the SUID is 4744 (u+s). The second is 754 without and 2754 (g+s) with, and the third is 777 without and 1777 (o+t) with. Hope this helps, Phil -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2008-08-11 13:23, Phil Savoie wrote:
Hi Sylvester/Ken,
Just to be correct, this is called SGID or set group ID.
<snip> That is of course correct, sorry for the mix up John, SGID bit was what i meant, not sticky bit. Thanks for clearing that up Phil. /Sylvester -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
John pecked at the keyboard and wrote:
Ken Schneider wrote:
By setting the owner/group (of the directory) _and_ setting the proper perms any file created by anyone in that directory becomes owned by the owner/group of the directory.
And how do I achieve this, please? My directories covered by this regime are already set to root:users but any new files put in them revert to root:root!
J
Per 'man chmod': chmod 6775 /path/to/directory -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
John
-
Ken Schneider
-
Kurt Wall
-
Michael S. Dunsavage
-
Phil Savoie
-
Sylvester Lykkehus