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.

151 questions
4
votes
2 answers

What causes git's post-receive umask to be different from the user's umask?

After some digging and help here from other people, I found out that I have a problem with the umask setting in git. What I want to achieve is that any git repo that is being checked out on my server, that the umask setting defaults to 0002. I don't…
user32421
  • 689
  • 3
  • 8
  • 19
4
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
  • 119
  • 1
  • 3
  • 10
4
votes
1 answer

how to give execute permission by umask

is it possible to assign execute permission for a file with the help of umask. As I google then find umask is not just the difference between 666 and assigned permission but it converts the digits to rwx then compare with umask by converting umask…
agarwal_achhnera
  • 2,582
  • 9
  • 55
  • 84
3
votes
1 answer

Why is umask setting in dockerfile not working?

I want some directory in my docker to have a specific umask value, say 000. I tried to set that in my dockerfile and in the ENTRYPOINT shell script, but they both failed to work, ... RUN umask 000 /var/www/html/storage/logs //the…
Qiulang
  • 10,295
  • 11
  • 80
  • 129
3
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
  • 13,411
  • 42
  • 184
  • 351
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…
GIZ
  • 4,409
  • 1
  • 24
  • 43
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
  • 471
  • 2
  • 4
  • 11
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
  • 1,017
  • 2
  • 12
  • 16
3
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 ;)
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…
arimbun
  • 3,885
  • 2
  • 19
  • 16
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
  • 157
  • 3
  • 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
  • 172
  • 2
  • 12
2
votes
2 answers

jinja2.exceptions.TemplateSyntaxError: expected token ',', got 'integer' (support for hex, octal, and binary integer literals)

In version 3.1.2 this is throwing an exception: >>> print(jinja2.Template("{{ '%04d' | format(0777 - '0022' | int) }}").render()) Traceback (most recent call last): File "", line 1, in File…
tersmitten
  • 1,310
  • 1
  • 9
  • 23
2
votes
1 answer

Umask In open() Syscall?

While reading about open syscall and in more details the parameters we send, I read: The umask acts as a set of permissions that applications cannot set on files. It's a file mode creation mask for processes and cannot be set for directories…
user16385268
2
votes
1 answer

How do I set a default umask in JupyterHub

How do I set a default umask (other than the standard 0022) for individual notebooks/users in JupyterHub? Use case: I'm using the SystemUserSpawner, which spawns a Docker container for a user, but hooked into the underlying (virtual machine) system…
9769953
  • 10,344
  • 3
  • 26
  • 37
1 2
3
10 11