LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   How can I set the permission on the home directory when creating an user (https://www.linuxquestions.org/questions/solaris-opensolaris-20/how-can-i-set-the-permission-on-the-home-directory-when-creating-an-user-587487/)

crisostomo_enrico 09-26-2007 08:00 AM

How can I set the permission on the home directory when creating an user
 
Hi all.

Both creating an user with useradd and with smc, the newly created directory has permissions 755, that is, the default umask 022 has been used.

Is there a way to change this behavior (I want a 700 permission on user home directories)?

Bye,
Enrico.

kebabbert 09-26-2007 02:41 PM

Yes you can change the umask. Dont remember how. Is there a "umask" command?

crisostomo_enrico 09-26-2007 02:47 PM

Yes, umask can be changed (with the umask command, too). But I wanted to change the umask as a last resource: moreover, it should be changed only when creating user... Is there any useradd related option?

jlliagre 09-26-2007 04:12 PM

There is no useradd option for setting permissions. The home directory is created with 0755 permissions. This is hardcoded in the command source code.

Of course, the current shell umask can limit these permissions. You can use
Code:

(umask 0077;useradd ...)
to achieve what you want without changing you current shell mask, or just use a wrapper script around useradd.

crisostomo_enrico 09-26-2007 06:24 PM

Thanks jlliagre.

Strange choice, isn't it? By default, and in most of the cases, I wouldn't like my home directory to be world readable!

Quote:

or just use a wrapper script around useradd.
What I was thinking about, if I couldn't found a solution.

Thanks, as always.
Enrico


All times are GMT -5. The time now is 11:17 AM.