I just found the following comment in /etc/login.defs
:
# Enable setting of the umask group bits to be the same as owner bits
# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
# the same as gid, and username is the same as the primary group name.
This sounds cool, but it doesn't behave like that on my system:
me@mysystem ~ $ id
uid=1000(me) gid=1000(me) Gruppen=1000(me),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),113(lpadmin),130(sambashare),133(roccat)
me@mysystem ~ $ touch test
me@mysystem ~ $ ll test
-rw-r--r-- 1 me me 0 Aug 17 20:02 test
me@mysystem ~ $ rm test
me@mysystem ~ $
(following replacements were made (nothing else): my_real_user_and_groupname => me, my_real_hostname => mysystem)
My primary group is my personal group (as the group assignment of the test file shows), but I don't know a CLI command to check this. I checked it via GUI instead.
Anyone knows why the behaviour described in this comment does not affect my environment?
Or cleaner: why is test
created with -rw-r--r--
instead of -rw-rw-r--
on my system?
Update:
me@mysystem ~ $ cat .bashrc | grep -e umask -e UMASK
me@mysystem ~ $ cat .profile | grep -e umask -e UMASK
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
me@mysystem ~ $ cat /etc/profile | grep -e umask -e UMASK
me@mysystem ~ $ cat /etc/bash.bashrc | grep -e umask -e UMASK
me@mysystem ~ $ umask
0022
me@mysystem ~ $
Update 2
me@mysystem / $ grep -r 'umask [0-9]' /etc/ 2> /dev/null
/etc/init/ssh.conf:umask 022
/etc/ppp/ip-down.d/0dns-down:umask 022
/etc/ppp/ip-up.d/0dns-up:umask 022
/etc/dhcp/dhclient-enter-hooks.d/samba: umask 022
/etc/init.d/umountfs:umask 022
/etc/init.d/ssh:umask 022
/etc/init.d/resolvconf: umask 022
/etc/init.d/urandom: umask 077
/etc/init.d/urandom: umask 022
/etc/init.d/urandom: umask 077
/etc/init.d/rc:umask 022
/etc/skel/.profile:#umask 022
/etc/X11/Xsession:if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
me@mysystem / $
This file takes effect when you are logging into the system and set things up for once.
If you run:
You can see that the default
UMASK
is022
and if you check its comments you will find out that:Open a terminal and run:
You should get
002
because ofUSERGROUPS_ENAB
being enabled, otherwise you are overwritingumask
's value somewhere else like: