[Klug-general] managing multiple users
David Halliday
david.halliday at gmail.com
Fri Sep 24 09:30:35 UTC 2010
Try pumping it into the for loop.
I have a script (to hand) which takes an input from another script (or
command line) and processes it line by line like this:
while read line
do
echo $line
someFunctionCall $line
done
Could execute like:
sudo cat /etc/passwd | grep '/home' | cut -d : -f 1 | ./newScript.sh
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
>
> ????
>
>
> 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
>
>
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/kent/attachments/20100924/c939b6fc/attachment.htm>
More information about the Kent
mailing list