Re: Best practice for users/groups on solaris

Mike Renfro
Thu, 08 Nov 2007 23:12:07 -0000

On 11/8/2007 4:18 PM, seph wrote:

> The virt_all_users way of managing users seems pretty reasonable, but
> I don''t see how to deal with user specific groups with that.
>
> class virt_all_users {
>
>     @user { "seph":
>         ensure  => "present",
>         uid     => "1001",
>         gid     => "1001",
>         comment => "seph",
>         home    => "/home/seph",
>         shell   => "/bin/bash",
>     }
> }
>
> But realizing that on a solaris machine generates an error because
> group 1001 doesn''t yet exist. Specifically:
>
> err: //virt_all_users/User[seph]/ensure: change from absent to present
failed: Could not create user seph: Execution of ''/usr/sbin/useradd -u
1001 -s /bin/bash -d /home/seph -g 1001 -c seph seph'' returned 1536:
UX: /usr/sbin/useradd: ERROR: group 1001 does not exist.  Choose another.

I''d guess that you need to define some groups ahead of time:

@user { "seph":
     ensure  => "present",
     uid     => "1001",
     gid     => "seph",
     comment => "seph",
     home    => "/home/seph",
     shell   => "/bin/bash",
     require => group["seph"]
}

group { "seph":
     ensure  => "present",
     gid     => "1001",
}

--
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University