SLES 12: Setting the default group for new users using the /etc/login.defs USERGROUPS_ENAB option does not work?

I am setting up a new SLES 12 server and want to set the default group for new users, so this is not called users , but rather <username> (p.ex. user foo will be assigned the group foo ).

I found that the USERGROUPS_ENAB option in /etc/login.defs should do this job, but after I changed it to USERGROUPS_ENAB yes and tried to create a new user via yast , that new user would be - according to yast - still assigned to users .

How can I execute the desired behavior through yast ? Or am I missing something?

+5
source share
1 answer

After changing USERGROUPS_ENAB to yes in the /etc/login.defs file /etc/login.defs you changed the behavior you want for the default useradd command. So, for example, you can run this command as root, and it will do what you expect:

 linux-54pe:~ # grep "USERGROUPS_ENAB" /etc/login.defs USERGROUPS_ENAB yes linux-54pe:~ # useradd bob linux-54pe:~ # cat /etc/passwd | grep bob bob:x:1003:1003::/home/bob:/bin/bash linux-54pe:~ # cat /etc/group | grep bob bob:!:1003: 

The problem is that you are using YaST2. YaST2 uses its own default group assignment and therefore does not take into account the default changes made to useradd. In /var/log/YaST2/y2log you can see that when I tried to create the user openly:

 2017-04-25 10:44:02 <1> linux-54pe(2871) [Perl] modules/Users.pm(Users::CommitUser):3517 commiting user 'frank', action is 'add_user', modified: 1, ldap modified: 0 2017-04-25 10:44:02 <1> linux-54pe(2871) [Perl] modules/Users.pm(Users::CommitGroup):3787 commiting group 'users', action is 'user_change_default' 

In addition, in the YaST2 module, when you create a user in the Details tab, you can see below that he assigns it to his own user group default setting.

screenshot showing parameter

If you are eligible for support with SUSE, you can contact them to find out if they are willing to present this as an error. At the very least, they should be able to include this as an extension request.

0
source

Source: https://habr.com/ru/post/1246121/


All Articles