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
1
vote
2 answers

How to find out where a umask is getting set for a user?

I've been battling with umask/permission problems for a while now in various cases. I have set www-data (run by nginx/php-fpm) to have a umask of 002 in the /etc/init/php-fpm.conf file, and my deployer user also has umask of 002 in…
timetofly
  • 2,957
  • 6
  • 36
  • 76
1
vote
2 answers

PHP ssh2_sftp_mkdir creating permission incorrectly

ssh2_sftp_mkdir($sftp, '/home/site',0774); I am using the above to create a folder remotely but instead of the folder having permissions 774 it is getting set as 754 meaning that it is not writeable by the group.
Kline
  • 47
  • 7
1
vote
1 answer

umask not working in c code

I have made a c code intended to create a file at root directory. #include #include #include #include const char *path="/"; int main(){ FILE *fp; umask(0); chdir(path); …
kwagjj
  • 807
  • 1
  • 13
  • 23
1
vote
1 answer

Apache umask setting not working properly

I want files created by Apache to have 660 permissions, so I added the line "umask 007" to the file "/etc/sysconfig/httpd" and it works MOST of the time (as weird as that sounds). For example, these files were created by Apache and the first one has…
Juan Pablo Barrios
  • 473
  • 1
  • 4
  • 6
1
vote
1 answer

Copying files into a tempfs in android (native)

I want to create a tempfs for specific photo-gallery app which supposed to have very high performance. More specificely, I have a code that creates a tmpfs, and I want a 3rd party photo-gallery app to access files in that tmpfs. I created a tempfs…
Bush
  • 2,433
  • 5
  • 34
  • 57
1
vote
3 answers

Transmission on FreeNAS umask / owner of files

going slightly crazy with Transmission installed on FreeNas 8.3.1 (not in a jail) Everything is fine except the ownership / permissions of the downloaded files, they are all owned by root and have mask: rwxr-sr-x I have tried changing 'umask' in…
bobomoreno
  • 2,848
  • 5
  • 23
  • 42
1
vote
0 answers

subversion permissions on files in .svn

I am setting up a shared working copy for web development. Most of the users are not unix/command line capable so they are connecting to the working copy on the webserver via Samba and using TortoiseSVN. I have set up default umask on bash and…
abruzzi
  • 81
  • 4
1
vote
1 answer

Debian doesn't obey umask on debian squeeze

I have been reading a bunch of posts here and at server fault about the umask an debian but I still don't compeltely understand what's going on with it. Here's my problem, tell me what I'm doing wrong: I'm on my machine and i type…
slappyjam
  • 69
  • 2
  • 10
1
vote
1 answer

Mac OS X App file Permissions

Our program creates various settings files that it needs to read and write to. However if the OS X user has a global umask set such that files are created without write permissions, our app cannot write to them. Requirements: Asking user to change…
nite
  • 763
  • 2
  • 9
  • 16
1
vote
4 answers

Creating a file with open() or creat() has fewer permission bits set than I asked for

I am writing a program to mimic the cp utility. However, I cannot get the file permissions to work correctly. I know that they are stored in the structure stat and stored in the st_mode field with stat. My issue is that I do not get the write…
tpar44
  • 1,431
  • 4
  • 22
  • 35
1
vote
1 answer

SCP and UMASK Linux Centos

I need to control the transferring of files on my server. Some files are sent through scp to my server and I want such a files to have a specific set of permissions let's say 770. I tried pam_umask.so in /etc/pam.d/login and setting umask in…
Kerby82
  • 4,934
  • 14
  • 48
  • 74
1
vote
0 answers

Is there an equivalent to umask for Windows, or another solution?

I have a VB.NET application that creates folder trees and sets permissions. I want the permissions on the folders the app creates to be read only for a normal user. But I want a user to be able to create and delete files/directories within this…
gimbel0893
  • 382
  • 3
  • 10
0
votes
1 answer

How to modify the default permissions for files saved by DolphinDB "saveText"?

For the files saved by saveText, only the specific user has the write access, other members of the group are not allowed to write to the file. How to modify the configuration to give the write permissions to the group?
Eva Gao
  • 402
  • 1
  • 7
0
votes
0 answers

Retrieving umask OR default permissions for file creation in PHP

If, as answered before, when using fopen() to write a non-existing file, without specifying its permissions, default OS permissions/umask are used to determine the new file's permissions... is it possible to retrieve such default permissions via PHP…
Jaume Mal
  • 546
  • 5
  • 21
0
votes
0 answers

File permissions log4j2 with RollingFile

I have problem with file permissions with RollingFile and log4j2 configuration. Application is creating log file as follows: -rwxr-xr-x. 1 centos centos 10379932 Feb 8 13:55 application.log after rolling files read permissions for others are…