Operating System - HP-UX
1834394 Members
1887 Online
110066 Solutions
New Discussion

Re: how to automaticaly chmod

 
SOLVED
Go to solution
Roxana_4
Frequent Advisor

how to automaticaly chmod

My names is Roxana Colta. I'm system administrator at UTB Brasov, Romania. I have the HP rx2600 Integrity with HPUX 11.23 .
In HPUX the XY user is owner of the file program.c .
The XY user is in PRO group .
Other users of the PRO group don't have any permmission to this file (- r w - - - - - - - XY PRO program.c) .
The quetion is : Is it possible that when the owner creates a new file program.c (with vi, or by copying it, etc) or compiling a source program program.c and obtaining an executable file program.out ,
to be accessed in r w x mode (- r w - r w - - - - XY PRO program.c) (- r w x r w x - - - XY PRO program.out)
by the PRO group members ? HOW ?
Please be so kind and describe in details all the modalities you know.

Thank you very mutch.

Best regards.

Roxana
8 REPLIES 8
Muthukumar_5
Honored Contributor

Re: how to automaticaly chmod

You have to change umask specification to XY user.

Change umask 006

touch test.c

ls -l test.c
rw- rw- --- ...

Put this change in /etc/profile or $HOME/.profile file.

hth.
Easy to suggest when don't know about the problem!
Sergejs Svitnevs
Honored Contributor

Re: how to automaticaly chmod

You can manually create executable shell script which chmod all *.c files to "g+rw" and *.out files to "g+rwx". Then schedule a script to run every minute using cron (set up a crontab job for user XY).

Regards,
Sergejs
Fred Ruffet
Honored Contributor
Solution

Re: how to automaticaly chmod

Roxana,

Basis is that files are created with 666 mode. To this mod is substracted umask.
Umask 002, files are created with 664
Umask 027, files are created with 640
...

umask 027 is a good choice for what you want.

For more information use "man umask" and search about information on chmods.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Matthew_50
Valued Contributor

Re: how to automaticaly chmod

perhaps, you can try acl

set default policy to $DIRNAME for future
create files, will automatic obtain the r-x
permission.

# setacl -m default:group:PRO:r-x $DIRNAME

use following to remove acl
# setacl -d group:PRO $DIRNAME
Cem Tugrul
Esteemed Contributor

Re: how to automaticaly chmod

Roxana,

The all other replies significant.
Especially using umask consept or automatically from the .profile but if you
decide to run it from crontab i advise you
to take a little bit care because 3 weeks
ago i have done for "chmod" to a nfs directory from
one of box to another and put it cron and
when urgent reboots needed so my cron can not
able to find&chmod nfs dir and this time chmod 777 run from /
:-))
so i have spent some time to fix it up
Good Luck,

Grts from Turkey,

Our greatest duty in this life is to help others. And please, if you can't
FERRARI MARCO
Advisor

Re: how to automaticaly chmod

We use the same technique of umask-ing all the users of the APPL group. Be careful they can mutually overwrite their files, probably a senior sysadm changed the umask to a secure 077 or the like.
You could also play on directories, 770-ing them so that users can COPY-AND-MODIFY-THEIR-COPY source files.
Good memories of your town, Marco

Re: how to automaticaly chmod

Roxana,

There are 2 problems here: one is creating a file with vi or cp, the other is generating an executable.
The first problem can be solved with the suggestions of the others whith the umask technique. The other problem can be solved by writing a wrapper script for compiling your C-program. The last thing this script does, is chmod g+rx program.out ( w is not necessary for running compiled programs ).

Greetings,
Philippe
Roxana_4
Frequent Advisor

Re: how to automaticaly chmod

Thank at everybody. I understand.