[olug] user management

Kenton Brede kbrede at gmail.com
Mon Dec 12 15:57:47 UTC 2005


On 12/12/05, Jake Churchill <reynacho at gmail.com> wrote:
> When adding users using 'useradd' it pulls the default information from
> the /etc/default/useradd file.  Mine is as follows:
>
> GROUP=100
> HOME=/home
> INACTIVE=-1
> EXPIRE=
> SHELL=/bin/bash
> SKEL=/etc/skel
> GROUPS=video,dialout
>
> My issue is that when I create a user, it adds them with the default
> group as users, which is GID 100.  What do I need to change to ensure
> that when I add a user, it specifies them with the group that is equal
> to their user name.  For example, user john needs to be added and his
> primary group must be john, rather than users.  Is there a way to alter
> this file so that it does that and so that it automatically sets the
> home directory to /home/john.
>
> I'm trying to figure out how to do this dynamically rather than specify
> everything manually.

Don't know what distro you're using but playing around with my Ubuntu
system I came up with -
#  adduser --disabled-login --gecos GECOS test_user
which will work if "USERGROUPS=yes" is set in /etc/adduser.conf

According to the useradd man page on Ubuntu, useradd requires the
group to exist prior to calling for it.  If that is the case with the
version you are using, you could create a script which would call
groupadd, and then useradd with the "-g" option to specify the group
name.

hth,
Kent

--
"It may be true that the law cannot make a man love me, but it can stop him
 from lynching me, and I think that's pretty important." - Martin
Luther King Jr.



More information about the OLUG mailing list