Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is a default access mode (e.g. 0755) for users home dirs in Ubuntu (e.g. what is output of ls -ld /home/*)? In other major linux distribs (Debian, RedHat, Gentoo, Arch)?

How can I change this default?

PS: Sorry, but I can't find an ubuntu now and test this myself.

share|improve this question
I'm not asking about umask, but about skel and home-dirs – osgx Jun 29 '11 at 16:42
Please don't add new information in the comments, but include it in the original question – bbaja42 Jun 29 '11 at 17:14
it is not a new info, it is comments about wrong understanding of my question – osgx Jun 29 '11 at 19:05

3 Answers

up vote 2 down vote accepted

When creating a user using useradd --create-home username, the skeleton directory (usually /etc/skel) is copied, including its permissions.

The home directory (/home/username) is subject to the UMASK setting in /etc/login.defs. This is set to 022 by default, so the permissions for /home/username becomes 755.

Relevant excerpt from the Ubuntu manual page of useradd:

The following configuration variables in /etc/login.defs change the behavior of this tool:
[..]
UMASK (number)

The file mode creation mask is initialized to this value. If not specified, the mask will be initialized to 022.

useradd and newusers use this mask to set the mode of the home directory they create

share|improve this answer
What about redhat/debian? – osgx Jun 29 '11 at 16:43
AFAIK it's a standard thing of useradd, if it would be Ubuntu-specific, it should have been mentioned in the manual page. A redhat manual page: linux.die.net/man/8/useradd – Lekensteyn Jun 29 '11 at 16:49

The default permissions for /home in ubuntu is rwxr-xr-x or 755. For /home/user it is also rwxr-xr-x or 755. At least it is on my installation.

To change the file permissions of the home directory, open a terminal and run something like:

chmod 700 /home/user

Remember to change the 700 to the chmod value that you actually want to set.

If you do not own the directory, you need root privileges to change the permissions. Ubuntu uses sudo for that:

sudo chmod 700 /home/user

When you run this command it will ask for the administrator password.

share|improve this answer
2  
Your second part is incorrect, the home directory is owned by yourself, so you won't need superuser right for that. – Lekensteyn Jun 29 '11 at 16:01
Your assuming he only wants to change the rights on his own home dir. I did say "If you do not own the directory." My code will work on the home dir of any user. – Rincewind42 Jun 30 '11 at 3:25
I edited your post to make it more correct (hopefully you like it), your original post did not include that at all: superuser.com/revisions/303995/1 – Lekensteyn Jun 30 '11 at 6:58

Check the umask man page.

The default umask setting is

0022

Allows group and others read and execute access.

share|improve this answer
No, My question is not about an umask, but about default permissions of user's folder itself (just after user a is created, what will be an output of ls -ld /home/a) – osgx Jun 29 '11 at 14:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.