fnichol/chef-user

Would like to create the user group with a specific gid

Closed this issue · 4 comments

I was hoping to be able to the user and group with specific ids:

user_account "testuser" do
  comment      "Test User"
  uid          9999
  gid          9999
  create_group true
  ssh_keygen   false
end

but this fails with:

[2012-09-28T23:25:59+00:00] DEBUG: Chef::Exceptions::Exec: user_account[testuser] (dummy-service::default line 10) had an error: Chef::Exceptions::Exec: user[testuser] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/user/providers/account.rb line 94) had an error: Chef::Exceptions::Exec: useradd -c 'Test User' -g '9999' -s '/bin/bash' -u '9999' -m -d '/home/testuser' testuser returned 6, expected 0
---- Begin output of useradd -c 'Test User' -g '9999' -s '/bin/bash' -u '9999' -m -d '/home/testuser' testuser ----
STDOUT: STDERR: useradd: group '9999' does not exist
---- End output of useradd -c 'Test User' -g '9999' -s '/bin/bash' -u '9999' -m -d '/home/testuser' testuser ----

You have to create the group first.

Also, take note that you have to mange the user's home directory when they are first created-- see http://tickets.opscode.com/browse/CHEF-2409

Note that there is a group resource to create the group. Thanks for this answer! This works, btw and this issue should be closed! 👍

I don't think we're talking about the same cookbooks. This is not the opscode user cb.

@tomdz I see this issue has been open for some time with no updates. I'm going to mark it as closed, because I think the clearest way to solve this problem is to make sure the group is created before calling the user_account provider.

If you think this should still be addressed I'm happy to re-open this issue.