Re: useradd creating home directory 755 instead of 700 (642 Views)
Reply
Occasional Contributor
pradeep10
Posts: 3
Registered: ‎08-31-2012
Message 1 of 8 (700 Views)

useradd creating home directory 755 instead of 700

HI All, Good Evening!!!

 

This doubt might be silly, but this is creating lot of security exposure.

 

When i create a user account using user add command, the home directory is getting created with 755 permission instead of 700 permission.

 

I've tried all means but no luck. i need the home directory to be created with 700 permission when i shoot useradd command. Can anyone help me out to resolve this issue.

 

Many Thanks in advance!!!

 

Regards,

 

Pradeep.

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,752
Registered: ‎06-21-2000
Message 2 of 8 (688 Views)

Re: useradd creating home directory 755 instead of 700

I have not been able to find a way to do that yet.

 

It would make sense for your umask to control that, but I set umask to 077 and a homedir was still created with 755 permissions.

 

I will continue to search.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,958
Registered: ‎03-06-2006
Message 3 of 8 (677 Views)

Re: useradd creating home directory 755 instead of 700

Is there anything in /etc/default/useradd that controls it?

 

Otherwise you can just use chmod go-rx after the useradd.

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,752
Registered: ‎06-21-2000
Message 4 of 8 (671 Views)

Re: useradd creating home directory 755 instead of 700

No, nothing in /etc/default/useradd regarding permissions.

Please use plain text.
Occasional Contributor
pradeep10
Posts: 3
Registered: ‎08-31-2012
Message 5 of 8 (664 Views)

Re: useradd creating home directory 755 instead of 700

Thanks everyone who gave a try for my query....I tried using /etc/default/useradd , but no luck ..one thing I need to mention here, if I have unasked as 077, and if I create the account using Sam, then home directory gets created with 700 permission....
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,958
Registered: ‎03-06-2006
Message 6 of 8 (658 Views)

Re: useradd creating home directory 755 instead of 700

>if I create the account using Sam, then home directory gets created with 700 permission.

 

I thought I checked recently but is there a useradd.sam like usermod.sam?

Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,752
Registered: ‎06-21-2000
Message 7 of 8 (649 Views)

Re: useradd creating home directory 755 instead of 700

Yes, there is a /usr/sam/lbin/useradd.sam, but it is just a link to /usr/sbin/useradd.  I looked at it but did not see anything that allows you to specify the homedirectory permissions.

 

 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,958
Registered: ‎03-06-2006
Message 8 of 8 (642 Views)

Re: useradd creating home directory 755 instead of 700

>it is just a link to /usr/sbin/useradd.

 

The program can just look at argv[0] and do something different.  Like usermod.sam.

 

>I looked at it but did not see anything that allows you to specify the homedirectory permissions.

 

But did you try it? ;-)  Of course kind of hard to find options if not present in the help.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation