Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a development Ubuntu system for which I have several users: myself (with full sudo) and about 5 other users. (I've set up the system so everything in this respect is still at its default setting)

I'm trying to set the system up so that multiple people can collaborate in a single directory by using grouing and I want the default permissions to be 664. However when some users edit files the permissions were 644.

After a lot of investigating most users have a umask (checked at the prompt) of 0002 and when they create files they are 664 (as expected) but there are 2 (myself and one other) who have 0022 umask (so the files that come out are 644 and nobody else can write to them).

I've looked everywhere but can't figure out why a couple users wind up with a different umask e.g. there is nothing the .bash_profile or anything like that)

Any ideas for the source of the discrepancy?

/etc/bashrc

if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
   umask 002
else
   umask 022
fi

/etc/profile

if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

EDIT:

My (bad) ~/.bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific aliases and functions


export LANG=en_US.utf8

Other user (good) .bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific aliases and functions
share|improve this question
    
What about in /home/user/.bashrc for the trouble users ? Also check this similar question. While not exactly your problem it may help you. –  drcelus Nov 26 '12 at 7:59
    
Thanks drcelus. I've edited the question. –  paullb Nov 26 '12 at 8:03

2 Answers 2

The umask is probably being set on

/etc/bashrc

or

/etc/profile

share|improve this answer
1  
Everything is the default setup. How would this account for it being set to something different for different users –  paullb Nov 26 '12 at 7:42

Judging from the files you provided the test statement in the /etc/bashrc seems to evaluate true for most users, but false for you and the other "bad" user. This can have to 2 possible reasons:

  • You and the other "bad" account have a UID below 200
  • You and the other "bad" account seem to be in a default group which is named differently than your user name.

You can test for this by looking at the output of the following things:

  • the output of the "id -u" (your user id) command and check if the output is below 200
  • the output of "id -un" (your user name) and "id -gn" (your group name) and check if they differ
share|improve this answer

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.