Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's a sequence of commands and the resulting output:

$ touch testfile
$ stat -c'%a %A' testfile
644 -rw-r--r--

What must I do so that when a user follows that sequence, I get this output instead:

664 -rw-rw-r--
share|improve this question
up vote 2 down vote accepted

POSIX defines the utility umask which sets the file mode creation mask, either for the current instance (without subshells), or for every newly invoked shell (over .bash_profile, .bashrc, etc.).

Show the currently set mask in octal or symbolic form:

$ umask
$ umask -S

The octal numbers indicate the values which are getting removed from the full access:

$ umask 0002     # or: umask g+w
$ touch testfile
$ stat -c'%a %A' testfile
664 -rw-rw-r--
share|improve this answer

You need to set the umask for that user to 0002. Right now, it's probably 0022. You can define it in your ~/.bash_profile with 'umask 0002'.

share|improve this answer

Under bash, umask sets the file-creation mask. With umask 002 you get the permissions you want. You can put this in .bash_profile locally or globally.

share|improve this answer

Your Answer


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.