Re: Shell Script to add multiple users with same password

From: Simran Hansrai (sparc@pacbell.net)
Date: Tue Feb 25 2003 - 17:07:16 EST


Hi Guys,

Thanks for all the replies. I forgot to mention that I could only use
cshell, bourne shell and korn shell. Most of the replies asked me to
use expect which I cannot use as well. But, Matt Doughty sent the
following piece of code which I will be using and will have to expand a
liitle but it should not be that hard. The only problem I am having is
how to set the password for all these accounts within this code. The
rest of it should be easy. Also, do you guys know if I can run the
actual commands in the code for example:

for (( i = $2 ; i <= $3 ; i++ )) ; do
                useradd -c "XXXXXXX" -s /bin/ksh $(1)$(i);
done

--cut--
#!/bin/bash

for (( i = $2 ; i <= $3 ; i++ )) ; do
        adduser ${1}${i};
done
--cut--

expand as needed.

Thanks again for all your replies,
Simran

Simran Hansrai wrote:

> Hi Guys,
>
> I have looked everywhere but I am not able to find such a script. Any
> suggestions or ideas would be gratelly appreciated, or any links to
> exsisting scripts would be perfect.
>
> I am trying to get a script that would do the following:
>
> #script r # #
>
> It will accept 3 arguments at the command line. The first is just a
> alphabet and the other 2 are numbers.
> example:
> #script r 1021 1082
>
> with that command the script will create accounts for users: r1021
> through users r1082 with the same passwords. No error checking is
> really needed. Any suggestions or ideas are again very appreciated.
>
> Thanks in advance,
> Simran
> _______________________________________________
> sunmanagers mailing list
> sunmanagers@sunmanagers.org
> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:53 EDT