[Klug-general] managing multiple users

Evan Ingram evan.ingram at cariss.co.uk
Fri Sep 24 09:18:09 UTC 2010


I had come across that link already :)

It prints all the usernames on seperate lines, what would I have to do
to get them all on oneline... userA userB userC?

Or is there a way the usermod script can take usernames on different
lines?

#!/bin/sh

for USER in 
userA
userB
userC
userD
userE
; do
  usermod -G USERS $USER
done

????


On Fri, 2010-09-24 at 10:09 +0100, David Halliday wrote:
> Some discussion on it
> here: http://www.linuxquestions.org/linux/answers/Networking/How_to_list_all_your_USERs
> 
> 
> I did this s few years ago to pull out Active Directory users:
> http://david-halliday.co.uk/?Linux:Make_/home/
>  (I wanted them to have a /home on a linux box so they had FTP, SSH
> and (as a result of a public_html directory) HTTP web hosting easily
> configured for educational purposes. While that wbinfo command is for
> ad users there might be something else but I can't find it yet.
> 
> 
> A short answer to your question could be something along the lines of:
> sudo cat /etc/passwd | grep '/home' | cut -d : -f 1
> 
> 
> 
> 
> On 24 September 2010 09:51, Evan Ingram <evan.ingram at cariss.co.uk>
> wrote:
>         Hi all
>         
>         I always assumed managing users would be a lot simpler in
>         linux, but im
>         struggling to find an easy way to add 500+ users into groups.
>         Got a
>         couple of groups that I need all users to be a part of.
>         
>         #!/bin/sh
>         
>         for USER in userA userB userC userD userE; do
>          usermod -G USERS $USER
>         done
>         
>         script above should do the trick, but then I'd need to get a
>         list of all
>         my usernames in the correct format, ie userA userB userC, so
>         i'd have to
>         use a combination of awk/sed/whatever on /etc/passwd. Is there
>         an easier
>         way?
>         
>         cheers
>         
>         
>         _______________________________________________
>         Kent mailing list
>         Kent at mailman.lug.org.uk
>         https://mailman.lug.org.uk/mailman/listinfo/kent
> 
> 
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent

-- 
Evan Ingram
Technical Manager
CARISS
CARISS House,
205 Westbrook Avenue,
Margate,
CT9 5HS

01843 823 724
www.cariss.co.uk

CARISS is a trading name of CARISS (ICT) Ltd
Company registered in England and Wales
Company Number - 7315254
VAT Number - 856 1229 22




More information about the Kent mailing list