[Klug-general] managing multiple users

James Morris jwm.art.net at gmail.com
Fri Sep 24 09:32:48 UTC 2010


On 24 September 2010 10:18, Evan Ingram <evan.ingram at cariss.co.uk> wrote:
> 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
>
> ????
>


#!/bin/sh

#notice backticks
USERS=`cat /etc/passwd |grep /bin/bash |grep [0-9][0-9][0-9] |cut -d: -f1`

for USER in $USERS
do
  usermod -G USERS $USER
done



More information about the Kent mailing list