Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What are the cons, for having a restrictive umask of 077? A lot of distros (I believe all, except Red Hat? ) have a default umask of 022, configured in /etc/profile. This seems way too insecure for a non-desktop system, which multiple users are accessing, and security is of concern.

On a related note, on Ubuntu, the users' home directories are also created with 755 permissions, and the installer states that this is for making it easier for users to share files. Assuming that users' are comfortable setting permissions by hand to make files shared, this is not a problem.

What other downsides are there?

share|improve this question
    
permissions seems more like it than 'umask' for tags... imo –  xenoterracide Aug 19 '10 at 9:42
    
You can have up to 5 tags for a question, so why fight about it? :) Added the umask tag. –  Warren Young Aug 19 '10 at 13:13
    
@warren because I dont' think we need tags for every single proper noun. when talking permissions in unix you have to include umask. –  xenoterracide Aug 22 '10 at 18:14
add comment

4 Answers

up vote 7 down vote accepted

022 makes things convenient. 077 makes things less convenient, but depending on the circumstances and usage profile, it might not be any less convenient than having to use sudo.

I would argue that, like sudo, the actual, measurable security benefit you gain from this is negligible compared to the level of pain you inflict on yourself and your users. As a consultant, I have been scorned for my views on sudo and challenged to break numerous sudo setups, and I have yet to take more than 15 seconds to do so. Your call.

Knowing about umask is good, but it's just a single Corn Flake in the "complete breakfast". Maybe you should be asking yourself "Before I go mucking with default configs, the consistency of which will need to be maintained across installs, and which will need to be documented and justified to people who aren't dim-witted, what's this gonna buy me?"

Umask is also a bash built-in that is settable by individual users in their shell initialization files (~/.bash*), so you're not really able to easily enforce the umask. It's just a default. In other words, it's not buying you much.

share|improve this answer
add comment

The most obvious downside is when you start creating files/directories in a shared directory, expecting other users to access them.

Of course, it's only a matter of not forgetting to set the correct umask before doing stuff that need to be shared by all users.

Another caveat (not really a downside, once you are aware of it) is when you start doing sudo stuff such as installing local programs, ruby gems, python eggs (not OS manage packages obviously), creating configuration files, and so on.

You will get into trouble for the umask is inherited by the sudo session, so only root will be able to access files/dirs you create. sudo can be configured to automatically set the umask the way you want: this question is covered on superuser.com.

share|improve this answer
    
and the latter reason is a good reason to su - and make sure root has a different umask... but oh... ubuntu doesn't believe in root... –  xenoterracide Aug 19 '10 at 9:41
    
@xenoterracide: sudo su - works fine. Ubuntu, like MacOSX, doesn't believe in a root you can just log into. Personally, I like having to say something like "Simon Says" for root commands most of the time. –  David Thornley Aug 19 '10 at 11:21
    
@xenoterracide eh? what's your point? both sudo and su allow for root having a different umask. @David you can use sudo -i instead of sudo su - –  zarkdav Aug 19 '10 at 18:34
    
@David if you're doing an su ... you're logging in as root. @zarkdav My point is actually using the root account helps with things like this. I don't agree with the whole 'no root' thing, it provides a false sense of security. ya'll can like it all you want, though. –  xenoterracide Aug 19 '10 at 21:03
    
@xenoterracide: Actually using the root command means I'm likely to type something into the wrong window. Using "sudo" means I have to specify I want this to be executed by root. I know perfectly well there's a root account, so I don't see where the false sense of security comes from. It's just one more little ritual (like sitting on my hands) that makes it less likely that I'll do something fatally stupid as root. –  David Thornley Aug 19 '10 at 22:03
show 6 more comments

Umask would not be appropriate if you are trying to control what other users can see from each other. However, if you have and work with numerous files that are sensitive to the point that being asked for permission to access them is less bothersome/risky than just letting people see whatever they want, than a umask of 077 would be a good idea.

I have some sensitive files on a file server I manage. I think setting a restrictive umask then having a periodic script, maybe a cron job to set more specific permissions to items in certain folders would be an ideal solution for me. When I set this up I will post back here, and let you know how it worked.

@[The guys bashing sudo] Start a new thread for it, it could take several threads of it's own and this thread is about umask.

share|improve this answer
add comment

I have this line in my ~/.zshrc

umask 0077

setting it globally is probably not a good idea, but setting it as the default in your rc file is probably not going to hurt or even setting it as the default in the /etc/skel/.rc file. system wide will cause problems though.

share|improve this answer
add comment

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.