1

I am running openSUSE 11.0 on a server which is copying (and processing) a lot of files. The new folders, which were received by some service running, have the default permissions drwxr-sr-x and the file are -rw-r--r--. My goal is to have default permissions for folder like drwxrwsr-x and for files like -rwxrwsr-- everytime a new file is creating or copied.

So basically I want to keep the group's write permissions.

This setting is supposed to be aimed at one specific user, not systemwide!

The group and owner of the files/ folders are always the same, also the processing (services and scrips) is running with the permissions of this one user.

The umask of this user is: 0002. (So umask isn't substracting the group's default write permissions.)

Thanks in advance for your help!

4
  • 1
    this wont work is an application enforces the mode, for example 644. Umask can only lower permissions (from man page): The effective permissions are modified by the process's umask in the usual way: The permissions of the created file are (mode & ~umask).
    – kofemann
    Feb 21, 2013 at 12:23
  • @tigran Does every application enforces its "mode"? Why an application itself is allowed to set this mode? Shouldn't it be the operation system dealing with the permissions of programs?
    – K B
    Feb 22, 2013 at 8:43
  • 1
    mode is the part of POSIX API which means all applications have to specify mode on create. Some APIs hide it from you, for example open function in python. But under the hod mode 0666 is used and newly created file will have mode equal to ( 0666 & ~0022 ), where 0022 is the umask. The umask which you set tells system what to subtract from from specified mask.
    – kofemann
    Feb 22, 2013 at 9:32
  • @tigran And whose umask is applied? I mean, where can I set it? According to Tim Haegele I need a more global place for this setting than in my .bashrc. But as I only want to set the umask "globally" for one user (= not systemwide), what can I do?
    – K B
    Feb 25, 2013 at 11:56

1 Answer 1

1

Where did you set the Umask?

If you use .bashrc, it gets only sourced if you call "bash", so your service needs to a bash script otherwise it will use the systemwide definition of Umask for the user through pam_umask.

You should use /etc/login.defs and have a look at "man 8 pam_umask"

3
  • The description in /etc/login.defs says: Umask which is used be useradd and newusers for creating new home directories. Doesn't sound like a systemwide definition of umask for all services/ processes. But in fact at the moment it is set to 022, i.e. substracting group's write permission.
    – K B
    Feb 21, 2013 at 15:37
  • And furthermore it would be better if the setting isn't systemwide but limited to one specific user.
    – K B
    Feb 21, 2013 at 15:46
  • you are right. My Statement was unclear through the lack of proper english. What I mean is umask in login.defs or in "GECOS" is independend of the shell. In addition tigran made an excellent point. Feb 21, 2013 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .