How to create multiple users using expect.?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to create multiple users using expect.?
Prev   Next
# 1  
Old 12-04-2013
How to create multiple users using expect.?

Hi, guys. I need help on some expect problem.

Code:
#!/usr/bin/expect
set user [lindex $argv 0]
set password [lindex $argv 1]
set newuser [lindex $argv 2]
spawn telnet x.x.x.x
expect login*
send “root\r”
expect Password*
send “123546\r”
send "useradd $newuser\r"
send "exit\r"
interact

I can add 1 user using expect script, but how do I add 300 with names like Tom1,Tom2,Tom3.....,Thank you all very much.

Last edited by bartus11; 12-04-2013 at 06:29 PM.. Reason: Please use code tags
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Ubuntu

Expect /bash, 2 ssh login users

HI all i need to connect to about 900 cisco routers and switch to do some configs changes. the issue i am having is that half the devices have one set of username and password and the other half have another username and password. From expect or bash script i can ssh into a device and make... (1 Reply)
Discussion started by: quintin
1 Replies

2. Shell Programming and Scripting

Create Multiple UNIX Files for Multiple SQL Rows output

Dear All, I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File. The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files. Any... (14 Replies)
Discussion started by: Rahul_Bhasin
14 Replies

3. Shell Programming and Scripting

Create multiple users with individual passwords to users

hi, i am new to shell scripts i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Discussion started by: DONFOX
1 Replies

4. Shell Programming and Scripting

using expect to switch users in a script

hi, I need to switch users in a script I'm newbee to expect I wrote two files 1 sudo.exp, since su4098 is used as root in my laptop #!/usr/bin/expect spawn su su4098 expect *Password:* send mypsw\n interact 2 test.sh ls ./sudo.exp tcpdump -i wlan0 su esolve ls however, in... (1 Reply)
Discussion started by: esolve
1 Replies

5. Solaris

Can we create multiple users with same UID?

* Can we create multiple users with same UID? * Can we give root permissions to normal user like admin.s ? If YES give me full details (syntax of sudo/RBAC) (14 Replies)
Discussion started by: Navkreddy
14 Replies

6. Shell Programming and Scripting

Create new users

Hi , i would like to create a new user over unix ,which are these commands to used and which are the directories to handler? Thank you (3 Replies)
Discussion started by: dimitris
3 Replies

7. Solaris

How to create users in NIS

How to create users in NIS server in solaris Thanks in Advance (6 Replies)
Discussion started by: durgaprasadr13
6 Replies

8. UNIX Desktop Questions & Answers

How to create users on HP UX????

I new to unix and I'm using a HP UX and I'm logging in as user: root. I wish to create new users by using the 'useradd' command. When I keyed in' useradd -u 101 -g group john', the reply was 'Group group specified with -g does not exist'. I've read the man page on useradd and I still don't... (8 Replies)
Discussion started by: mascotlee
8 Replies
Login or Register to Ask a Question
srptool(1)						      General Commands Manual							srptool(1)

NAME
srptool - Simple SRP password tool SYNOPSIS
srptool [options] DESCRIPTION
Very simple program that emulates the programs in the Stanford SRP (Secure Remote Password) libraries using GnuTLS. It is intended for use in places where you don't expect SRP authentication to be the used for system users. In brief, to use SRP you need to create two files. These are the password file that holds the users and the verifiers associated with them and the configuration file to hold the group parameters (called tpasswd.conf). OPTIONS
--bits BITS specify the number of bits for prime numbers (used only when the --create-conf option is used). --create-conf FILE Generate a tpasswd.conf file. -h, --help Prints a short reminder of the command line options. -i, --index INDEX Specify the index of the parameters in tpasswd.conf to use. -p, --passwd FILE Specify a password file. -c, --passwd-conf FILE Specify a password configuration file. -s, --salt SALT Specify salt size for crypt algorithm. -u, --username username Specify username. --verify Just verify password. EXAMPLES
To create tpasswd.conf which holds the g and n values for SRP protocol (generator and a large prime), run: $ srptool --create-conf /etc/tpasswd.conf This command will create /etc/tpasswd and will add user 'test' (you will also be prompted for a password). Verifiers are stored by default in the way libsrp expects. $ srptool --passwd /etc/tpasswd --passwd-conf /etc/tpasswd.conf -u test This command will check against a password. If the password matches the one in /etc/tpasswd you will get an ok. $ srptool --passwd /etc/tpasswd --passwd-conf /etc/tpasswd.conf --verify -u test AUTHOR
Nikos Mavrogiannopoulos <nmav@gnutls.org> and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list. This manual page was written by Ivo Timmermans <ivo@debian.org>, for the Debian GNU/Linux system (but may be used by others). February 21st 2005 srptool(1)