Questions tagged [umask]

Mask that controls which file permissions are set for files and directories when they are created. It also refers to a function that sets the mask, and to the mask itself, which is formally known as the file mode creation mask.

Filter by
Sorted by
Tagged with
131
votes
3answers
194k views

Make all new files in a directory accessible to a group

Suppose I have two users Alice and Bob and a group GROUPNAME and a folder foo, both users are members of GROUPNAME (using Linux and ext3). If I save as user Alice a file under foo, the permissions ...
18
votes
3answers
16k views

Why doesn't umask change execute permissions on files? [duplicate]

If I change the umask to 0000, I'd expect a text file to be created with rwxrwxrwx permissions (based on my understanding of the umask, as described in the "possible duplicate" question) However, when ...
18
votes
2answers
83k views

How to check umask for all users under Linux?

Under AIX I can check the umask for all users with: cut -d : -f 1 /etc/passwd | while read ONELINE; do lsuser -a umask "$ONELINE"; done But how can I check the umask setting for all users under ...
15
votes
1answer
25k views

How is umask calculated in Linux?

So I know umask can restrict privileged users, using this format umask ugo. I understand that the read = 4, write = 2, and exec = 1. However, when I type umask, it returns 4 digits which is 0022 or ...
14
votes
6answers
12k views

Downsides of umask 077?

What are the cons, for having a restrictive umask of 077? A lot of distros (I believe all, except Red Hat? ) have a default umask of 022, configured in /etc/profile. This seems way too insecure for a ...
14
votes
3answers
34k views

How to set umask for a system-user?

Is it possible to set the umask for a system-user (created with useradd --system username)?
12
votes
2answers
7k views

How can I change the umask for one command only?

How can I interactively execute a command in Linux (zsh, if it matters) with a different umask from the default, for one command only? Perhaps a combination of commands combined in a single line? The ...
10
votes
2answers
6k views

What is the first digit in umask value? [duplicate]

If I understand correctly file permissions have an associated 3 digit number which specify read/write/execute permission. The umask value is a default 'mask' which is subtracted from the default ...
10
votes
9answers
4k views

How to set `umask` for the entire gnome session?

Using Gnome 3.18. I share files between other family members, but the default umask on my distro (archlinux) is 0022. So every file/directory created is not writable for our common group. I tried to ...
10
votes
4answers
1k views

Why are files in my home dir being created as world-writable despite a more-restrictive umask?

I've realized that the permissions for new files and directories behave a bit strangely. First of all, umask seems to return the right answer: $ umask 0002 This means full access for my user and my ...
9
votes
2answers
3k views

Why do some umask values not take effect?

I'm trying to understand permissions better, so I'm doing some "exercises". Here's a sequence of commands that I'm using with their respective output: $ umask 0022 $ touch file1 $ ls -l file1 -rw-r--...
9
votes
3answers
316 views

Permissions on Files:

I would like to give 755 permissions to a directory, so I use: # chmod -R 755 /my/folder/ It works for all files inside my folder, but the problem is that I use scripts that create new files in this ...
8
votes
1answer
5k views

Why is the default umask 002 or 022 in many Unix systems? Seems insecure by default [closed]

I have been using Linux & Unix for a long time. The first time I learned Unix is in a computer classroom with many students, where the instructor told us that you can use ssh to log in to remote ...
7
votes
2answers
3k views

How umask works [duplicate]

I'm new to Linux. I have been practicing a few commands. My question is about when I'm creating different files using a different umask. For example: umask 222, as I understand it, is the same as 777 ...
7
votes
3answers
613 views

Historically why is umask the way it is?

umask has always tripped me up. Logically I would prefer to have a 'setmask' instead that takes chmod-style arguments. Anyone know why it is the way it is?
7
votes
2answers
14k views

Setting umask for su root

In my user account I set the umask to be 022 with my .bashrc, but I want root to use a umask of 077 no matter how I become root (e.g., logging in directly as root on a tty or using sudo or su). If I ...
7
votes
2answers
9k views

Confused on file and directory permissions for Samba shares

I've been searching for while to try to understand the following mask/mode fields for creating files/folders in Samba shares: create mask force create mode directory mask force directory mode But I'...
6
votes
2answers
7k views

How to make scp respect umask

My scp doesn't respect umask setting of the user it's sending files to. Is there a setting somewhere or should I use a different solution?
6
votes
1answer
1k views

Default umask 077 not applied at session start

I cannot get the default umask for a session to be 0077. I have edited /etc/login.defs and set the value to 077 there: UMASK 077 Also I've made sure the following entry exists in /etc/pam....
6
votes
0answers
899 views

Understanding sshfs and umask

I have a remote access to a server. There I have my umask set to 0007. I refer to my server name as "sme", my local name as "lme". So I do the following: sme@server$ touch f1 sme@server$ ls -l f1 -rw-...
5
votes
4answers
10k views

Why is the default umask value for useradd in openSUSE set to 022?

I recently built a very simple test environment with openSUSE. As I tried to configure a shared directory, without using ACLs, but with SetGID on that directory instead for some reason, I noticed ...
5
votes
1answer
5k views

Umask not working [closed]

I'm trying to figure out how to use umask. I ran umask 027 expecting this would result in all permissions for myself, read and execute for group, and none for everyone else. Based on a default of ...
5
votes
2answers
2k views

How to change permission of anonymous pipe?

I've the script which loads the SSH key from the variable (as part of script in CI environment) in order to not keep the private file in the public repository, however ssh-add complains about the ...
5
votes
2answers
8k views

Using umask to set group permissions

A long time ago an old friend showed me a way to use an octal or hex umask with a group I think using /etc/profile. I'm not sure. I'm trying to create group on Debian so that every member of that ...
5
votes
0answers
715 views

Setting umask of libvirt/virt-manager for proper permissions in a directory shared by host and guest

I'm attempting to create a directory that is fully available to both the host and guest systems of a virt-manager/libvirt/QEMU/KVM virtual machine, with read, write and execute permissions for non-...
5
votes
3answers
2k views

mkdir permissions do not correspond to umask (change depending on location)

Whenever I create new directories in my home (or its subdirectories) they do not have write permission, even though umask is set correctly. Files I make DO have write permission. [mmanary@seqap33 ~]$ ...
5
votes
4answers
10k views

scp and umask setting

How do I make SCP respect umask ? I've tried adding this Subsystem sftp internal-sftp -u 0002 in /etc/ssh/sshd_config and session optional pam_umask.so umask=0002 in /etc/pam.d/...
4
votes
5answers
10k views

Set the default permission when creating a file

When I create a file, the permission is 644 (user rw, group r, other r). How can I make the default file generated to have permission as 664?
4
votes
1answer
2k views

What is the exact purpose of `mask` in file system ACL?

When I apply default ACL in a directory I see default:mask or just mask in the following two scenario. Scenario 1 -bash-4.2$ ls -ld test/ drwxr-x---. 2 test test 4096 Oct 15 19:12 test/ -bash-4.2$...
4
votes
2answers
8k views

How to make a cifs/smb mount ignore umask?

I have a cifs mount that is mounted from /etc/fstab. But I would quite like creation of files/dirs on that share to ignore my umask. Is that possible? It seems that cifs does not support the umask=000 ...
4
votes
3answers
13k views

How can I have a separate umask for directory or user?

I want a separate umask for a directory or a user. How can I do this? Edit: I am using Debian 6. The reason why I want to do this is, I want all my SFTP users to create files with write on group. ...
4
votes
1answer
2k views

set umask for sshfs-mounted filesystem

I have a remote sshfs filesystem mounted on /mnt/data. Following is the relevant line in /etc/fstab: www-data@192.168.1.10:/var/www/ /mnt/data fuse.sshfs rw,noauto,nodev,nosuid,noexec,_netdev,...
4
votes
2answers
22k views

My machine has no hostname “Failed to start hostname.service: Unit hostname.service is masked.”

I was trying to change the hostname on my machine according to this article: https://www.blackmoreops.com/2013/12/12/change-hostname-kali-linux/ When I got to the part service hostname.sh stop sleep ...
4
votes
3answers
212 views

What are the conventional file permissions per filetype before umask is applied

I am looking for a list that specifies the conventional file permission of all the different file-types before the umask is applied. I read in man 1p touch that the default for a regular file is: ...
4
votes
1answer
2k views

umask changes to 0002 after cd

I've noticed an odd behavior on my Ubuntu 12.04 LTS system. This is my first experience with Ubuntu; previously I used Fedora and never had this problem. I have set my umask in .bashrc to 0027. But ...
4
votes
1answer
4k views

Set sudo umask apart from the user calling it

The problem: I set my umask for my user to be 0077. Now I use sudo instead of su when I need super-user access, and the problem is that whenever I execute a software installation using sudo with ...
4
votes
1answer
2k views

setting default umask and user:group on directory

I have a directory data and I need to set default umask and ownership for all directories/files (both existing and future files). I want all files in data to have ownership root:martin ans ...
3
votes
2answers
10k views

Different Umask for Directories and Files

How can I set up a different umask for directories then files? I need dirs with umask 003 and files with umask 117
3
votes
1answer
324 views

How to make autoconf use “install” instead of “mkdir -p”?

When I run sudo make install on a compiled package from the GNU archive, it uses mkdir -p to create the destination directories. I'd prefer it to use mkdir -p -m 0755 or install -d -m 0755 instead in ...
3
votes
3answers
9k views

Different permission between directory and file with 'umask'

Why is umask setting a different permission for a directory and file I have created Consider: [user@server1 ~]$ umask 0770 [user@server1 ~]$ mkdir TEST2; touch TEST2.txt; [user@server1 ~]$ ls -l d----...
3
votes
1answer
198 views

umask not being applied? [duplicate]

I am setting the umask to a new value as below. However although I am applying rxw to the user, this does not seem to be respected (?) /home/pkaramol $ umask u=rxw,g=rw,o=r /home/pkaramol $ umask -...
3
votes
2answers
2k views

umask XXX (permission bits) to give execute permission to files

Because files created by default having permission of 666 and umask (in permission bits form) subtract bit-wise from this permission, can we do something to give execute permission without using ...
3
votes
2answers
2k views

SFTP clients uploading files with too restrictive rights

I have the following setup: Ubuntu 14.4 server offering SFTP service in a front-end area. External clients have the ability to upload files. A back-end process (on another server) tracks uploaded ...
3
votes
2answers
818 views

Setting correct permissions automatically for certain file type when file is copied from non-Linux file system

The main reason I want this is my heavy use of dircolors, especially for ls --color=auto. For example, whenever a .mp3 file is copied from NTFS, it will have permissions set by umask 022 which ought ...
3
votes
1answer
3k views

Set umask for systemd unit

I am running rsync daemon with a specific user on Ubuntu machine. The problem is that since daemon users don't login, the umask set for the user is the default one. How do I set umask for the user in ...
3
votes
1answer
2k views

How to have correct permissions of files from usb disks?

Does anyone have the following problem? I have an Ubuntu box at work and also one at home. I always copy folders/files to/from an usb disk to/from my boxes. I have to change permissions of folders/...
3
votes
2answers
262 views

What is the proper solution to a web server trying to write to a directory?

So, I have a box with a "deploy" user. This deploy user owns a code repository and wordpress is running on this box... When wordpress attempts to do something like upload a plugin, it is using the ...
3
votes
1answer
471 views

umask vs -m, --mode command options

Is there any technical merit/necessity to numerous *nix commands (mkdir, mkfifo, mknod) having a -m (--mode) option? I ask this because near as I can tell, umask (both the shell command and the ...
3
votes
1answer
372 views

files saves to ntfs drive adhere to umask, ext4 does not

I have 2 storage drives, 1 is NTFS and the other is ext4. Both mounted in /media as Storage_1 and Storage_2 I've run chmod -R *user*:*user* /media/Storage_* I've tried putting umask=022 in /etc/bash....
3
votes
1answer
804 views

How to display the permissions of a new file in the status line of the Vim editor?

With the following piece of code I get the permissions for an existing file: augroup Get_file_perm autocmd! autocmd BufWinEnter,FileChangedShell * let w:file_perm=getfperm(expand('%:p')) augroup ...