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
0
votes
1 answer

Effect of umask on text files

I understand how umask works, at least a basic level, when dealing with the permissions of an executable file or directory. However, I struggle when it comes to how umask applies its rules to text files. For example, consider the umask 037. On…
user3277807
  • 63
  • 1
  • 10
0
votes
1 answer

Setting umask with lftp in bash

I am trying to write a bash script to upload some files using lftp and need to set the umask to 002. I cant seem to figure out how this is done within the context of lftp. lftp -c "open sftp://$STAGE_FTP_HOST user $STAGE_FTP_USER…
Cluke009
  • 63
  • 1
  • 5
0
votes
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
  • 37
  • 6
0
votes
1 answer

Setting chmod value in Ubuntu for all newly created files

How can I set 777 to all newly created files in some directory? I have tried looking on google, but it's really confusing to me. Thanks in advance.
truе
  • 97
  • 1
  • 12
0
votes
2 answers

Where can I set umask for system account?

I have created a system account that's used by some process specifically. I want to set umask 002 for it. For regular user account, I usually put configuration like this in .profile. This approach is not suitable for system account, as .profile is…
tamakisquare
  • 15,251
  • 24
  • 79
  • 125
0
votes
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
  • 373
  • 1
  • 3
  • 5
0
votes
1 answer

giving 2 diff users access to a folder

I need to give access to 2 users one with read access and other with write access to a particular folder(/folder). Both the users are supposed to be in the same group(sftp) user with read access: readsftp user with write access: writesftp I have…
user3407570
  • 125
  • 2
  • 11
0
votes
1 answer

UMASK, Virtualmin, WordPress and Ubuntu 12.04

I've deployed a new VPS with DigitalOcean. It's a standard LAMP stack and I'm testing a WordPress installation after creating a new "Virtual Server" in Virtualmin but it's UMASK is 022 and I need it to be 002. So I updated /etc/login.defs line 151…
Spencer Hill
  • 839
  • 2
  • 12
  • 30
0
votes
1 answer

file creation mask and umask

I was reading about file creation mask in a book and came across this: For example, if the value of the mask is 04+02+01=07 then the permissions normally indicated by these values are turned off whenever a file is created. So, with this value…
Guranjan Singh
  • 674
  • 1
  • 7
  • 24
0
votes
1 answer

umask for extra permissions like set group id on directories

How can I set the umask to make new directories with set-group-id flag as defaulte? (I use bash on CentOs6) I try: umask 5022 bash: umask: 5022: octal number out of range Or: umask 05022 bash: umask: 05022: octal number out of range Or: umask…
Udi
  • 117
  • 8
0
votes
1 answer

Uploading file to FTP using PHP - will not write to server

I'm trying to upload a file to an FTP server. It gets caught in the if statement which states that the directory must be chmode 777 however I have manually chmode 77 every directory in the ftp as well as adding a function in the code. Secondly, I'd…
FootsieNG
  • 709
  • 2
  • 10
  • 26
0
votes
1 answer

Debian FTP user permissions

I'm new to Linux and it's command line and I need to change user rights on FTP server. The situation is like this: I have a Debian server (without GUI, only with command line) with FTP server. And I have 2 users. Root (all access) and webmaster…
Racky
  • 1,103
  • 16
  • 23
0
votes
2 answers

Set owner:group and 770 chmod to apache2 created files

I would like configure apache to create files with personalized owner:group and chmod. I have an folder of website who need to be manipulated by apache + (ftp) user. Actually i do an (where 'mygroup' is group of ftp users) chown www-data:mygroup -R…
bux
  • 5,543
  • 8
  • 35
  • 68
0
votes
1 answer

Can I get a callback / do I know when SQLite has created write-ahead log files? I want to chmod them

I have an elevated process and I want to make sure the SQLite files that it creates are readable by other processes. For some reason umask doesn't seem to do what I want (set permissions of sqlite file created by process). I'm using write-ahead…
Joe
  • 42,600
  • 24
  • 134
  • 225
0
votes
1 answer

Changing Apache/PHPs default file permissions

I have an Amazon EC2 server running Redhat. When my PHP CMS creates files they are owned by www-user and has chmod 644. How can I make all files created by Apache and PHP default to 666? I've already tried adding "umask 002" in /etc/init.d/httpd but…
frigg
  • 1,479
  • 4
  • 20
  • 38
1 2 3
8
9