カテゴリ:

This is traditional way of making user. At first, you need group (vegetable). Then you make a user (cabbage) with initial group vegetable. This time user cabbage has umask 022.

# groupadd vegetable
# useradd -g vegetable cabbage
# id cabbage
uid=509(cabbage) gid=505(vegetable) groups=505(vegetable)
# su - cabbage
$ umask
0022
$ touch hello
$ ls -l hello
-rw-r--r--  1 cabbage vegetable 0 Feb 25 09:01 hello

You could make a user (lettuce) without initial group. This time user automatically belongs to an initial group that has users name. The user has umask 002.

# useradd lettuce
# id lettuce
uid=510(lettuce) gid=510(lettuce) groups=510(lettuce)
# su - lettuce
$ umask
0002
$ touch hello
$ ls -l hello
-rw-rw-r--  1 lettuce lettuce 0 Feb 25 09:03 hello