Creating users with added groups fails on primary
I have two identical clusters using local user database (passwd/group). I have one 2 system HA cluster running 2.0.3. Another 2 system HA cluster running 2.1.3. The both experience that same thing. What I do to one I also do to the other at a backup site.
built on Fri Apr 12 10:27:56 EDT 2013
built on Thu May 01 15:52:13 EDT 2014
When adding a new user with 2 groups the primary ends up without the added groups and the secondary ends up with the users added to the groups (via sync).
An error log on the primary reveals that the userid does not exist when the group was added. It seem like either the group change is done before the user add or the useradd takes time so when the group change comes along the user add is still in process.
I haven't test 2.2 preview.
Jul 23 11:09:59 php: /system_usermanager.php: The command '/usr/sbin/pw groupmod somegroup1 -g 2001 -M 2003,2001,2000,2006,2007,2009,2011,2013,2014,2004,2016,2017,2019,2012,2020 2>&1' returned exit code '67', the output was 'pw: user `2020' does not exist' Jul 23 11:09:59 php: /system_usermanager.php: The command '/usr/sbin/pw groupmod somegroup2 -g 2000 -M 2000,2001,2002,2003,2004,2006,2007,2009,2011,2013,2014,2016,2017,2019,2012,2020 2>&1' returned exit code '67', the output was 'pw: user `2020' does not exist'
2020 does exist in /etc/passwd on the server if I check it right after adding the user. The /etc/group does not show the user added to the group.
The way I fix it is after creating the user I remove the groups from the user. Save. Add the groups back. Save. After that the group has the user assigned in /etc/group. I haven't tried just adding the groups after creating the user but I suspect that would work as the user definitely exists at that point.