Changing default /home/dir permissions

Support for security such as Firewalls and securing linux
Quitch
Posts: 76
Joined: 2006/04/28 16:50:40

Changing default /home/dir permissions

Postby Quitch » 2008/08/21 08:32:37

I wish to change the default permissions on new folder under /home from 755 to 750. How should I go about doing this?

NedSlider
Forum Moderator
Posts: 2886
Joined: 2005/10/28 13:11:50
Location: UK

Re: Changing default /home/dir permissions

Postby NedSlider » 2008/08/21 10:53:50

Using the chmod command.

If man pages (man chmod) make little sense to you, then google will find you tutorials. Here's the first one I found:

http://catcode.com/teachmod/

Hope that helps.

Quitch
Posts: 76
Joined: 2006/04/28 16:50:40

Re: Changing default /home/dir permissions

Postby Quitch » 2008/08/21 15:42:27

Sorry, I wasn't clear, I meant I want to change the default permissions for new user's home folders, rather than changing them each time they're created.

User avatar
toracat
Forum Moderator
Posts: 7229
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Changing default /home/dir permissions

Postby toracat » 2008/08/21 16:00:34

Then you want to look into umask.

NedSlider
Forum Moderator
Posts: 2886
Joined: 2005/10/28 13:11:50
Location: UK

Re: Changing default /home/dir permissions

Postby NedSlider » 2008/08/21 16:14:48

Umm, the defaults for new user accounts are set in /etc/login.defs - the setting you're looking for is the umask value:

# The permission mask is initialized to this value. If not specified,
# the permission mask will be initialized to 022.
UMASK 077

By default the umask is set to 077 meaning the default permissions on any new home folders will be 700. Files/folders users create in their home dirs may be 755 by default but no one will be able to access these if they can't traverse the directory tree to get there (you need permissions from the / (root) directory to open (execute) each directory).

I'm guessing you want to change the default create umask for each user so folders and files they create are 750 (umask 027)? I think you can probably set this globally in /etc/profile or individually in ~/.bashrc

Hope that helps :-)

EDIT: toracat was quicker than me :-D

User avatar
AlanBartlett
Forum Moderator
Posts: 9311
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: Changing default /home/dir permissions

Postby AlanBartlett » 2008/08/21 16:34:13

Correct me if I'm wrong (I could well be) but I believe umask is set globally in /etc/bashrc for users of bash . . . :-)

NedSlider
Forum Moderator
Posts: 2886
Joined: 2005/10/28 13:11:50
Location: UK

Re: Changing default /home/dir permissions

Postby NedSlider » 2008/08/21 17:35:24

AlanJBartlett wrote:
Correct me if I'm wrong (I could well be) but I believe umask is set globally in /etc/bashrc for users of bash . . . :-)


Thanks Alan - it does indeed look as if you are correct :-)

intel233
Posts: 10
Joined: 2017/07/15 15:31:04

Re: Changing default /home/dir permissions

Postby intel233 » 2017/08/06 18:59:54

Are you sure its reading from /etc/bash and not /etc/login.defs? My UMASK in bashrc is 002 and when I created a new user and look at the permissions of the directory it is 700. If it read from bashrc wouldnt it be 775? My login.defs UMASK is 077 which would make the dir 700.

User avatar
TrevorH
Forum Moderator
Posts: 20966
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Changing default /home/dir permissions

Postby TrevorH » 2017/08/06 20:53:55

Somehow, on a 9 year old topic, I suspect no-one cares.

Locked.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke