Unix questions - Any umask alternative?

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > December 2004 > Any umask alternative?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Any umask alternative?
Ultra Kiasu

2004-12-29, 7:55 am

I need to spool a file in one public directory (775) to have a
permission of 664 (u=rw,g=rw,o=r).
Currently it create files with 644 (u=rw,g=r,o=r) permission.

The problem: (This script does not work)
============
umask 113 (or 002)
/usr/local/bin/myscript.sh $parm1 $parm2 >>/tmp/logfile.log 2>&1


The umask setting does not take into effect in background process.

Limitation:
===========
1) I can't change the "myscript.sh" shell script, except parent calling
script.
2) I can't change the directory permission of the public directory.
What are my alternative?

Thank you in advance.

Regards,

Kevin

Chuck Dillon

2004-12-29, 5:57 pm

Ultra Kiasu wrote:
> I need to spool a file in one public directory (775) to have a
> permission of 664 (u=rw,g=rw,o=r).
> Currently it create files with 644 (u=rw,g=r,o=r) permission.
>
> The problem: (This script does not work)
> ============
> umask 113 (or 002)
> /usr/local/bin/myscript.sh $parm1 $parm2 >>/tmp/logfile.log 2>&1
>
>
> The umask setting does not take into effect in background process.
>
> Limitation:
> ===========
> 1) I can't change the "myscript.sh" shell script, except parent calling
> script.


I suggest that you first determine specifically why you are getting the
permissions you are. Is the script setting umask or is something else
going on. It's hard to suggest a solution without an understanding of
what all is involved.

FWIW, from the calling script you can affect what myscript.sh does
without changing it directly. For example, you could use awk or sed or
whatever to filter the script and then call the filtered version. Or
you could source it instead of calling it and possibly have an effect
on it (e.g. use a function/alias to override some call it is making).
You could also possibly change its execution path and interpose your
own version of commands it uses (e.g. cp).

Why can't your calling script let myscript.sh do it's thing and then
afterwards change the permissions to the desired settings?

-- ced

> 2) I can't change the directory permission of the public directory.
> What are my alternative?
>
> Thank you in advance.
>
> Regards,
>
> Kevin
>



--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com