Por que os diretórios Documents, Desktop, etc. não são graváveis em grupo por padrão?

0

Se eu criar novos arquivos e diretórios no meu diretório inicial, eles serão graváveis por grupo:

will@together:~$ touch test
will@together:~$ mkdir test_dir
will@together:~$ ll | grep test
-rw-rw-r--  1 will will         0 Apr 23 10:36 test
drwxrwxr-x  2 will will      4096 Apr 23 10:36 test_dir/

A razão para este comportamento é devido ao modo Debian / Ubuntu de lidar com usuários e grupos, chamado Grupos Privados de Usuários .

Acabei de fazer uma nova instalação do Ubuntu e notei que os diretórios criados automaticamente (Documents, Desktop, etc.) não podem ser gravados em grupo.

will@together:~$ ll | grep Documents
drwxr-xr-x  2 will will      4096 Apr 22 22:21 Documents/

Eu estava imaginando qual é o motivo disso.

    
por Will Levine 23.04.2016 / 16:49

2 respostas

0

Isso ocorre porque, em /etc/login.defs , o padrão umask é definido como 022 quando seu diretório pessoal é criado. 022 é a umask "histórica" que existia antes da ideia de grupos privados surgirem. Mas USERGROUPS_ENAB yes in /etc/login.defs muda para 002 (para qualquer coisa criada depois que seu diretório home é criado).

As configurações em /etc/adduser.conf substituirão a mencionada acima somente se os grupos privados estiverem desativados. A motivação para mudar para 002 é que, com o surgimento de grupos privados, 022 tornou-se muito restritivo, por exemplo: para configurar diretórios compartilhados.

Você pode ver mais informações sobre isso no Lauchpad e Log de bugs da comunidade . Além disso, de /etc/login.defs :

> # UMASK is the default umask value for pam_umask and is used by
> # useradd and newusers to set the mode of the new home directories.
> # 022 is the "historical" value in Debian for UMASK
> # 027, or even 077, could be considered better for privacy
> # There is no One True Answer here : each sysadmin must make up his/her
> # mind.
> #
> # If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value
> # for private user groups, i. e. the uid is the same as gid, and username is
> # the same as the primary group name: for these, the user permissions will be
> # used as group permissions, e. g. 022 will become 002.

# 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.
#
# If set to yes, userdel will remove the user´s group if it contains no
# more members, and useradd will create by default a group with the name
# of the user.
#
USERGROUPS_ENAB yes
    
por Ron 23.04.2016 / 18:24
1

Primeiro, você pode ll -d Documents e salvar grep quando for necessário.

Em /etc/adduser.conf encontra-se:

# If DIR_MODE is set, directories will be created with the specified
# mode. Otherwise the default mode 0755 will be used.
DIR_MODE=0751

Veja man adduser e man adduser.conf .

    
por waltinator 23.04.2016 / 17:42