per default – different distributions set different accessrights for newly created files.
it seems “per default” – every file creation process would set the access rights to ugo+rwx (all rights for all users and groups) – umasks overwrites this “default” setting to make things more secure.
[cc lang=”bash” escaped=”true” width=”600″]
user@suse:~> touch newfile
user@suse:~> ll|grep newfile
-rw-r–r– 1 user users 0 11. Mai 12:08 newfile
user@suse:~> umask
0022
-> octal: 0/0/2/2 -> this translates to binary: 000/000/010/010
user@debian:~$ touch newfile
user@debian:~$ ll|grep newfile
-rw-r–r– 1 user user 0 May 11 12:09 newfile
user@debian:~$ umask
0022
-> octal: 0/0/2/2 -> this translates to binary: 000/000/010/010
[user@centos ~]$ touch newfile
[user@centos ~]$ ll|grep newfile
-rw-rw-r–. 1 user user 0 11. Mai 12:09 newfile
[user@centos ~]$ umask
0002
-> octal: 0/0/0/2 -> this translates to binary: 000/000/000/010
user@suse:~> umask 077
user@suse:~> touch newfile_umask_077
user@suse:~> ll|grep newfile_umask_077
-rw——- 1 user users 0 11. Mai 12:32 newfile_umask_077
[/cc]
per default every – Debian/Ubuntu/RedHat/CentOS create for every new user – a new group with the same name – SUSE12 does NOT.
so while under debian/ubuntu a new user with “username” automatically belongs to a newly created group “username” and his home is set to username:username
per default every new user in SUSE12 is member of a common group called “users”. Ask SUSE why 😀 (this allows every user basically to “look into” all other user’s home directory – not sure if this is wise and why)
on SUSE12 the /home/username is set to username:users
make umask settings permanent:
You can set umask in
# Debian/Ununtu/Suse
echo "umask 022" >> /etc/bash.bashrc
# CentOS/RedHat
echo "umask 022" >> /etc/bashrc
or
# all distros
echo "umask 022" >> /etc/profile
for all users.
By default most Linux distros will set it to 0022 (022) or 0002 (002). (src)
manpages:
set file mode creation mask – umask.man.txt
Links:
https://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html
https://www.kernel.org/doc/man-pages/
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!