Questions tagged [umask]

umask is a Unix command to specify default permissions for the new files, created by the current user. umask is inverted ( umask 0 = world readable, writeable and executable).

umask is a Unix command to specify default permissions for the new files, created by the current user. umask is inverted ( umask 0 = world readable, writeable and executable).

It is used when multiple users produce some shared data but any user must be capable of overwriting this data.

The default umask is often selected so to 022 (only owner can modify the file but the group and the world can read) or to 002 (owner and group can modify the file, the world can read).

umask accepts the same bitwise mask as chmod command, but it is inverted: it specifies bits that must not be set. For instance

 umask 555
 touch t.tmp
 ls -l t.tmp

will result

 --w--w--w- 1 me 0 2013-01-25 09:11 z.tmp

(444 is the "write only" flag). By concept, the mask serves for removal of permissions (000 - nothing is removed, 777 - all removed).

Regardless of umask, the newly created files may not be executable, for instance on Ubuntu 10.04:

 umask 0
 touch x.tmp
 ls -l x.tmp

will anyway result

 -rw-rw-rw- me 0 2013-01-25 09:36 x.txt

even if the lowest (execute) bit is 0 in umask.

134 questions
3
votes
1 answer

Is there a way to create executable files in Python without os.chmod for *nix systems?

By default open writes files with 666 octal permission: -rw-rw-rw-. I wonder if there's a way to make open creates files with the execution bit set. For instance, if presumably my system's umask value is 0000 then any file written with open will be…
direprobs
  • 3,601
  • 18
  • 38
3
votes
0 answers

setting umask for hive client

How can I set the umask for an Hive HQL script? Either via statements within the script or via a client side configuration set before running the script? I want to make the change on the client side without changing the server side…
Jeff Taylor
  • 461
  • 2
  • 4
  • 10
3
votes
1 answer

Python os.open() can not set umask to 777 (755 max)

My python script creates a file if it doesn't exist, reads and writes that file. The script may be run by root (automated) or by the user (refresh request). I need the file to be created with write permission so that in both cases the file can be…
pinhead
  • 907
  • 2
  • 10
  • 14
3
votes
4 answers

Setting umask for sshfs mount

If I mount the sshfs server with no umask, i get -rw-rw-r-- on new created files. If I try and open a php file on the server on my browser, i get this error: Incorrect file/directory permissions: Above 755. In order files to be processed by the…
masavini
  • 89
  • 2
  • 9
3
votes
0 answers

SSH: Set umask before command execution

I am writing a script which will SSH into a remote server and execute some commands. The problem I am facing is that the commands are altering file permissions on the remote server which is unintended. What I normally do, is to ssh to the server…
Arthur Rimbun
  • 2,973
  • 2
  • 14
  • 15
3
votes
2 answers

How do you change the umask when building with rpmbuild?

I've tried 'umask 77' in the shell, then building it with: [non-root-user@machine SPECS]$ rpmbuild -bb SPECFILE.spec but I still get this from the output: + umask 022
aafc
  • 127
  • 2
  • 10
3
votes
2 answers

ripmime permissions for attachments

We're using ripmime with Procmail to extract email contents into files. When extracting the email body (the text) ripmime correctly uses the configured procmail UMASK (022) for the files, but when there is an attachment it creates the file for the…
DavidK
  • 162
  • 2
  • 12
2
votes
2 answers

How do I configure umask in alpine based docker container

I have a Java application that runs in docker based on the cutdown alpine distribution, I want umask to be set to 0000 so that all files created by the application in the configured volume /music are accessible to all users. The last thing the…
Paul Taylor
  • 12,050
  • 34
  • 149
  • 295
2
votes
3 answers

Laravel filesystem sftp set umask for new folders

is it possible to set a umask for new created folders Storage::disk('sftp')->put('/path/to/folder/new/test.txt', $contents); In my case, the used umask is 744. Is it possible to change the umask for new created folders? Thanks in advance.
Smoky
  • 97
  • 1
  • 9
2
votes
1 answer

Make remote git set file permissions to owner r,w only

From my local git, I push to my private remote repo (via ssh), where I would like all files to be stored without any permissions for group, and in particular without access for others. I have attempted to help myself by setting an git internal umask…
humanityANDpeace
  • 3,392
  • 3
  • 28
  • 50
2
votes
1 answer

Why is the way of setting permission by os.mkdir in python different from one of mkdir in bash?

I made directories with file mode by mkdir in bash and os.mkdir in python. They made directories with different permissions. My test code in command line is following, $ mkdir -m 0775 aaa $ cd aaa $ mkdir -m 0777 bbb $ python -c 'import os;…
mora
  • 1,837
  • 2
  • 11
  • 26
2
votes
2 answers

Umask jsvc Log Files

I have an application hosted by jsvc on Centos 6. There are a number of logs created along with it. My problem is that jsvc is creating those logs with 077 permissions which are not accessible by anybody but root. The logs should be readable by…
user3063045
  • 1,367
  • 2
  • 15
  • 25
2
votes
1 answer

How to set umask default for an user?

Does anybody know how can I set an umask by default for an user and force them to use it? I think put umask 0002, for example, in his ~/.bashrc file but if I do that, they can change umask. Thanks ;)
2
votes
1 answer

Overriding fs.permissions.umask-mode in Oozie

I'm running a Java Oozie action which runs the usual prepare commands of deleting and creating a folder. The created folder has a umask of 022 (the cluster default), but I want it to have 002. In the workflow's job.properties I have…
Ben Watson
  • 3,882
  • 4
  • 33
  • 55
2
votes
2 answers

changing file permissions of default mkstemp

I call the following code in C: fileCreatefd = mkstemp(fileName); I see that the file is created with permissions 600 (-rw-------). I want to create this temp file as -rw-rw-rw- I tried playing around with umask but that only applies a mask over…
Abhishek
  • 215
  • 6
  • 16
1 2
3
8 9