1755889 Members
3850 Online
108838 Solutions
New Discussion юеВ

homedir permission

 
Crystal_1
Frequent Advisor

homedir permission

Hi,

I set up umask as 027 within the /etc/profile. But why when I create a new user, its home directory permission is 755?

But any directories I created under this homedir, the permission is the same as what I think, 750...

Crystal


17 REPLIES 17
Pete Randall
Outstanding Contributor

Re: homedir permission

Crystal,

How are you creating the user?
The creation process is setting permissions on the home directory without regard to your umask.

Pete

Pete
Helen French
Honored Contributor

Re: homedir permission

Just tried the same thing in my test system and it worked fine for me ! It created the $HOME directory with permission 750. I 've created the user with SAM and before that changed my umask to 027.

Before adding the users, check the umask with:

# umask
Life is a promise, fulfill it!
Crystal_1
Frequent Advisor

Re: homedir permission

Hi,

I put the umask in /etc/profile as 027 and logged out and logged on...

Then ran the command "useradd -m test", and check the permission of /home/test, it is
drwxr-xr-x.

I tried several systems and they gave me the same result...

Crystal
Crystal_1
Frequent Advisor

Re: homedir permission

Hi,

I did another test:

1.Change the umask from 027 to 022 in /etc/profile, log out and log on.

2. useradd -m testnew
3. the new homedir is the same 755

If it is true that no matter what the umask is, it won't change the home directory's permission.

Now my question is :

Can I change this defaul setting to make the new created homedir 750?

Tx, Crystal
Helen French
Honored Contributor

Re: homedir permission

what is the output of 'umask' ?

Did you try creating with sam ? are you getting the same result there ?
Life is a promise, fulfill it!
S.K. Chan
Honored Contributor

Re: homedir permission

Nothing wrong with your umask setting. I'm not sure but I think the "useradd" command has it's umask hardcoded as 755, that's why no matter what umask you set, it'll not work at the home dir level. Either you don;t use "useradd" or manually change the home dir permission afterwards.
Helen French
Honored Contributor

Re: homedir permission

Again, I suspect you have another umask set in the local profile ($HOME/.profile). This will overwrite the /etc/profile 'umask' value. Confirm this with command:

# umask ( display current umask)

During my test, the HOME directory was created depend on the umask. So I believe the same.

Setting permission to $HOME directories is up on your wish. But if you share the same HOME directory with another user/group, then set the permission accordingly. To change permission:

# chmod
# chown
Life is a promise, fulfill it!
Martin Johnson
Honored Contributor

Re: homedir permission

I think useradd has a hardcoded 755.

You have to be careful using useradd because it also does a "chown -R" to change the ownership of the files in the home directory.

I had an SA who set up a pseudo root account with / as his home directory. All the files on the system were subsequently owned by him. This was a pop3 mail server. Mail delivery was broken until I restored the files to their proper owners.

Marty

P.S. The SA now has a nickname of "chown boy".
:-)
Helen French
Honored Contributor

Re: homedir permission

Again, tested the same with 'useradd' command and found the HOME directory permission is 755, even if the umask is set to 027. So I think 'useradd' keeps the permission always as 755, but SAM takes input from 'umask' value.
Life is a promise, fulfill it!