Changing default /home/dir permissions

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

Changing default /home/dir permissions

Post by 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: 2897
Joined: 2005/10/28 13:11:50
Location: UK

Re: Changing default /home/dir permissions

Post by NedSlider » 2008/08/21 10:53:50

Using the [b]chmod[/b] 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

Post by 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
Site Admin
Posts: 7518
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Changing default /home/dir permissions

Post by toracat » 2008/08/21 16:00:34

Then you want to look into [b]umask[/b].

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

Re: Changing default /home/dir permissions

Post by 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 [i]think[/i] you can probably set this globally in /etc/profile or individually in ~/.bashrc

Hope that helps :-)

[b]EDIT:[/b] toracat was quicker than me :-D

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

Re: Changing default /home/dir permissions

Post by AlanBartlett » 2008/08/21 16:34:13

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

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

Re: Changing default /home/dir permissions

Post by NedSlider » 2008/08/21 17:35:24

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

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

Post by 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
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Changing default /home/dir permissions

Post by TrevorH » 2017/08/06 20:53:55

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

Locked.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Locked