Is there a command to change primary group for a new user in Cygwin?

Posted by Rob Gilliam on Super User See other posts from Super User or by Rob Gilliam
Published on 2013-10-22T15:13:51Z Indexed on 2013/10/22 15:57 UTC
Read the original article Hit count: 244

Filed under:

Is there a way to set a (new) user's primary group in Cygwin's /etc/passwd file without hand-editing the file?

I have a local group set up for members of the Dev Team on a Windows Server 2008 R2 box so that we can all modify a particular group files, but the regular users can only read them. As some of the work we do uses scripts that rely on Cygwin tools, this group is also in the /etc/group file.

When I need to add a new user to the "Dev Team" group, I add them in Server Manager, and then use mkpasswd to add that user to Cygwin's /etc/passwd file. Unfortunately, they get the regular Domain Users group assigned as their primary group and I then have to go in and edit the passwd file to change the group.

I now need to write some instructions for someone else who is not au fait with UNIX/Linux/Cygwin so that they can set up new Dev Team users and obviously "hand editing" /etc/passwd is a recipe for disaster if you don't know what you're doing.

So, is there a way of getting mkpasswd to set a different primary group, or another tool like Linux's usermod which can be used for the purpose of changing the group in a more controlled manner?

© Super User or respective owner

Related posts about cygwin