Re: Unix file permissions

  • From: "Jared Still" <jkstill@xxxxxxxxx>
  • To: James.Foronda@xxxxxxx
  • Date: Wed, 20 Sep 2006 11:34:15 -0700

There's another, simpler way to do that.

Change the group of the dump directory to 'users',
or any other group that works for you, but it must
be a group that the users have access to.

Then set the SUID bit on the group. All files created
in that directory will then have the group of the directory,
regardless of the group setting of the process that
creates the file.

eg.

[root]# mkdir test
[root]# ls -ld test
drwxr-xr-x  2 root root 4096 Sep 20 11:31 test
[root]# rmdir test
[root]# mkdir test; chgrp users test
[root]# ls -ld test
drwxr-xr-x  2 root users 4096 Sep 20 11:31 test
[root]# chmod g+s test
[root]# ls -ld test
drwxr-sr-x  2 root users 4096 Sep 20 11:31 test
[root]# touch test/x
[root]# ls -ld test/x
-rw-r--r--  1 root users 0 Sep 20 11:31 test/x
[root]#



On 9/20/06, James Foronda <James.Foronda@xxxxxxx> wrote:

I don't know how to do that from Oracle BUT from OS level, the following works in Solaris 10. It could also work in AIX.

My bdump dir is in /tmp/testbdump:

o10R1/O10gR1@oracle> ls -ltr /tmp/testbdump/*
-rw-r-----   1 oracle   dba          573 Sep 20 09:49
/tmp/testbdump/test_ora_21918_testusr_572.trc
-rw-r-----   1 oracle   dba           13 Sep 20 09:52
/tmp/testbdump/dont_change_this.txt

I can do this to change the permission of all *trc files under my bdump:

o10R1/O10gR1@oracle> find /tmp/testbdump -type f -name "*trc" -exec
chmod o+r {} \;

What that says is: Start a find from /tmp/testbdump.  Find all files
(-type f, excludes directories, symlinks, etc.) whose name end in trc
(-name "*trc") and for each file that meets that criteria, add read
permission for "others".

Verify the changes:

o10R1/O10gR1@oracle> ls -ltr /tmp/testbdump/*
-rw-r--r--   1 oracle   dba          573 Sep 20 09:49
/tmp/testbdump/test_ora_21918_testusr_572.trc
-rw-r-----   1 oracle   dba           13 Sep 20 09:52
/tmp/testbdump/dont_change_this.txt
o10R1/O10gR1@oracle>

If that works for you, you can then put that in a cron job.



--
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: