Page 1 of 1

Changing default /home/dir permissions

Posted: 2008/08/21 08:32:37
by Quitch
I wish to change the default permissions on new folder under /home from 755 to 750. How should I go about doing this?

Re: Changing default /home/dir permissions

Posted: 2008/08/21 10:53:50
by NedSlider
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.

Re: Changing default /home/dir permissions

Posted: 2008/08/21 15:42:27
by Quitch
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.

Re: Changing default /home/dir permissions

Posted: 2008/08/21 16:00:34
by toracat
Then you want to look into [b]umask[/b].

Re: Changing default /home/dir permissions

Posted: 2008/08/21 16:14:48
by NedSlider
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

Re: Changing default /home/dir permissions

Posted: 2008/08/21 16:34:13
by AlanBartlett
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] . . . :-)

Re: Changing default /home/dir permissions

Posted: 2008/08/21 17:35:24
by NedSlider
[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 :-)

Re: Changing default /home/dir permissions

Posted: 2017/08/06 18:59:54
by intel233
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.

Re: Changing default /home/dir permissions

Posted: 2017/08/06 20:53:55
by TrevorH
Somehow, on a 9 year old topic, I suspect no-one cares.

Locked.