Mailinglist Archive: opensuse-edu (72 mails)

< Previous Next >
RE: [suse-linux-uk-schools] addins users to groups....... 500+
  • From: Thomas Adam <thomas_adam16@xxxxxxxxx>
  • Date: Fri, 1 Aug 2003 12:00:26 +0000 (UTC)
  • Message-id: <20030801115920.8139.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
--- Chris Puttick <chris@xxxxxxxxxxxxxxxxx> wrote: > I believe you can
just modify the spreadsheet and use the newusers
> command
> again - it can update bulk users as well as create them. Have a look at
> "man
> newusers" and "man 5 passwd" for details.

I wasn't aware of that :) Mind you, I always like the generic approach,
Chris, and it should work....

-- Thomas Adam

> -----Original Message-----
> From: Thomas Adam
> To: Andrew Nix; suse-linux-uk-schools@xxxxxxxx
> Sent: 8/1/03 12:00 PM
> Subject: Re: [suse-linux-uk-schools] addins users to groups....... 500+
>
> --- Andrew Nix <andrew.nix@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > >
> --- Thomas Adam <thomas_adam16@xxxxxxxxx> wrote: > --- Andrew Nix
> > > <andrew.nix@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > I
> > >> need to add 500+ user to a group. Does anyone know how I can this
> > >> > without adding each person individually? As I think I might be
> sat
> > >> in this
> > >> > seat for the next two weeks adding everyone and miss my holiday
> to
> > >> Ibiza!
> > >> > Cheers
> > >>
> > >> You can do something like this:
> > >>
> > >> for i in $(cat /etc/passwd | awk -F: '{print $1}'); do chown
> > >> $i.GROUPNAME;
> > >> done
> > >
> > > Actually, you don't do that! It won't work....
> > >
> > >
> > > for i in $(cat /etc/passwd | awk -F: '{print $1}'); do adduser $i
> > > GROUPNAME; done
> >
> > Will that add everyone in /etc/passwd? If so there are profiles in
> there
> > that dont need to be added to the group. I should have said this
> > earlier.
>
> I am fully aware of that, and it was a very quick hack.
>
> > I have a spreadsheet that was used to create all the profile and I
> want.
> > I
> > used a commmand something like:
> >
> > addnewuser <filename of spreadsheet>
> >
> > and it created them all for me! Can something similar be done with
> > groups?
>
> Assuming that you have the list of users, export it to a cvs (a comma
> separated file) and issue the command:
>
> for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G
> groupname; done
>
> You'll have to change the above so that $NUM is the column number that
> the
> username appears in (i.e. $1, $2, etc) and change "groupname" as
> appropriate.
>
> HTH,
>
> -- Thomas Adam
>
> > > The above will work!!!
> > >
> > > Sorry, Andrew,
> > >
> > > -- Thomas Adam
> > >
> > >
> > >
> > > =====
> > > Thomas Adam
> > >
> > > "The Linux Weekend Mechanic" -- www.linuxgazette.com
> > >
> > >
> >
> ________________________________________________________________________
> > > Want to chat instantly with your online friends? Get the FREE
> Yahoo!
> > > Messenger http://uk.messenger.yahoo.com/
> > >
> > > --
> > > To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@xxxxxxxx
> For
> > > additional commands, e-mail: suse-linux-uk-schools-help@xxxxxxxx
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@xxxxxxxx
> > For additional commands, e-mail: suse-linux-uk-schools-help@xxxxxxxx
> >
>
> =====
> Thomas Adam
>
> "The Linux Weekend Mechanic" -- www.linuxgazette.com
>
> ________________________________________________________________________
> Want to chat instantly with your online friends? Get the FREE Yahoo!
> Messenger http://uk.messenger.yahoo.com/
>
> --
> To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@xxxxxxxx
> For additional commands, e-mail: suse-linux-uk-schools-help@xxxxxxxx
>
> --
> To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@xxxxxxxx
> For additional commands, e-mail: suse-linux-uk-schools-help@xxxxxxxx
>

=====
Thomas Adam

"The Linux Weekend Mechanic" -- www.linuxgazette.com

________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/

< Previous Next >
Follow Ups
References