umask on directories and perms on new created home dirs

umask on directories and perms on new created home dirs

Post by Ralf Gros » Thu, 01 Mar 2001 23:22:32



Hi,

I have two short quetions.

1. Is there something  similar to  umask but on directories,  so a user
that changes into a particular directory gets automatically a new umask
(without typing umask 007).

eg.
/home        umask 022
/projekts   umask 007
...

I know that I can add the sgid bit to a directory to force all new
created files/dirs gets owned by a special group. But what about the
umask....

2. I use useradd to create new accounts. With the -m option I
automatically create the new directory. The new homedirectory then has
the permissions 0755, is there a configfile where I can set these
initial perms to 0700 (just for the useradd command).

Thanks, Ralf

--
Ralf Gross

* Linux is like a Wigwam. No Windows, no Gates, and an Apache inside *

 
 
 

umask on directories and perms on new created home dirs

Post by Tony Walto » Thu, 01 Mar 2001 23:33:32



> Hi,

> I have two short quetions.

> 1. Is there something  similar to  umask but on directories,  so a user
> that changes into a particular directory gets automatically a new umask
> (without typing umask 007).

If I understand your question correctly, you should be able to do this
by setting default ACLs on the directory.  See the setfacl manpage for
details.

Regards

--
Tony Walton

 
 
 

umask on directories and perms on new created home dirs

Post by Barry Margoli » Fri, 02 Mar 2001 07:34:32





>> Hi,

>> I have two short quetions.

>> 1. Is there something  similar to  umask but on directories,  so a user
>> that changes into a particular directory gets automatically a new umask
>> (without typing umask 007).

>If I understand your question correctly, you should be able to do this
>by setting default ACLs on the directory.  See the setfacl manpage for
>details.

No, I don't think so.  After the default ACL is applied, the process's
umask is applied to turn off permissions.

There's no per-directory umask.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

umask on directories and perms on new created home dirs

Post by Vincent Smeet » Fri, 02 Mar 2001 16:30:30



> 1. Is there something  similar to  umask but on directories,  so a user
> that changes into a particular directory gets automatically a new umask
> (without typing umask 007).

Hallo,

I have got something like this. I use the bash shell and have defined
the following variable:

  PROMPT_COMMAND='umask `ls -dl . | tr "stSTlL" "xx[-*]" | sed "s/^.\(...\)\(...\)\(...\).*/u=\1,g=\2,o=\3/" | tr -d -`'

The bash will execute the PROMPT_COMMAND every time just befor displaying
the prompt (after executing a 'cd dir'). The PROMPT_COMMAND defined here
will get the permissions of the current directory and set the umask so
new files and directories will have the same permissions.

It works well for me. It has only one problem with files in other
directories.

        cd dir
        touch other_dir/file

Here, the file will be created with the umask of 'dir and not that of
'other_dir'.

-- Vincent Smeets                 Competence Center Informatik GmbH
-- Tel. : +49-5931-805461         Postfach 1225
-- Fax  : +49-5931-805175         49702 Meppen, Germany

-- PGP fingerprint: 53 1C 3B 6F B6 9A EB 83  B4 7E 25 08 78 BD 5C 2C

 
 
 

umask on directories and perms on new created home dirs

Post by Ralf Gros » Fri, 02 Mar 2001 18:08:13


Hi,

thank you all for your help. At the moment I can't see how ACLs should
help me, but I will have a look at the  man page. I will also try the
scrip, maybe this is a workaround for my problem.

Ralf

--
Ralf Gross

* Linux is like a Wigwam. No Windows, no Gates, and an Apache inside *

 
 
 

umask on directories and perms on new created home dirs

Post by Casper H.S. Dik - Network Security Engine » Fri, 02 Mar 2001 18:31:08


[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]





>>> Hi,

>>> I have two short quetions.

>>> 1. Is there something  similar to  umask but on directories,  so a user
>>> that changes into a particular directory gets automatically a new umask
>>> (without typing umask 007).

>>If I understand your question correctly, you should be able to do this
>>by setting default ACLs on the directory.  See the setfacl manpage for
>>details.
>No, I don't think so.  After the default ACL is applied, the process's
>umask is applied to turn off permissions.

Not true; not any more, at least.

When a default ACL exists, the umask of a process is ignored.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

umask on directories and perms on new created home dirs

Post by Tony Walto » Sat, 03 Mar 2001 21:08:00






> >> Hi,

> >> I have two short quetions.

> >> 1. Is there something  similar to  umask but on directories,  so a user
> >> that changes into a particular directory gets automatically a new umask
> >> (without typing umask 007).

> >If I understand your question correctly, you should be able to do this
> >by setting default ACLs on the directory.  See the setfacl manpage for
> >details.

> No, I don't think so.  After the default ACL is applied, the process's
> umask is applied to turn off permissions.

That used to be the case - it isn't any more (bug 1237009).

--
Tony