Hi,
Thanks a log for the quick replay but I think it is not good cause it sems that no matter what if founds it continues.
I'll explain better the situation:
Environment: Production, servers don't allow for root ssh connections.
The need that I had was to create a script for creating users on all the servers (more than 200 Unix,Linux)
What I've done so far is:
I had created a script that login each server with gets "user login name", "user password" and "user to be created"
The the script reads from a file, the servername and rootpassword and apss all the information to the expect script in form of parameters
The expect script uses the parameters ($0 $1.....) for connecting to the servers as the entered user, puts the password, changes to root, sends useradd....."user to be created" and then logs of and continue to the next one.
The thing here is that the script works but due to differences on the servers I need to cover all the posibilities for it to work fast and without error.
for login I had the following at the script:
spawn ssh $username@$ipaddr
match_max 100000
and then :
because I set timeout to -1 the script waits for ever when it logs into a server with the prompt "[whatever]$"
but putting the timeout to 5(for example) I pass (waiting) the $ paths and after entered "su -" and password, it recognise well the "[whatever]#" prompt for root and don't wait at all, sending the useradd command in no time.
Hi,
I am working on PGP encryption. I am getting public keys from some file.
One of the key has dollar sign in it "$" Example: "abc$123"
echo 'passphrase='$passphrase --> Giving correct value abc$123
But if I use $passphrase in PGP command getting Invalid passphrase error.
If I... (10 Replies)
I have a script that does an SSH into a remote node. It should expect the prompt and send the password.
#!/usr/bin/expect
set user ;
set pass ;
spawn ssh $user@E-Internal
expect {
-re "RSA key fingerprint" {send "yes\r"}
timeout... (1 Reply)
Hi guys,
I am trying to install a software which is a shell script. I am using expect to do the silent installation.
There is a strange line during the installation of the software like this below. The prompt goes to the next line.
ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE... (0 Replies)
there is a word "welcome"
output should be "welcome\
i am using regsub to add backslash "\" in place where ever i find square brackets (open or close)..
But i am not getting it... pls help out..
set a {welcome}
set d (5 Replies)
Hi.
Here is beginning of my script
#!/usr/local/bin/expect --
set timeout 15
spawn /usr/local/account.sh -n modify
expect "Password:" {send "mypassword\r"}
But due to some terminal control sequences (or something else, dunno exactly) my password prompt is looking like this:
and expect... (3 Replies)
Can somebody tell me the difference between double brackets and single
brackets, when doing a test.
I have always been acustomed to using single brackets and have not
encountered any issues to date. Why would somebody use double brackets.
Ie
if ]
vs
if
Thanks to... (2 Replies)
I have an Expect script which works very well. It logs into my remote routers and runs some commands and then to the next until finished. I need two things, first I need to save the output to a file from where the log_user 1 begins.
expect << EOF
set timeout 15
#set var "exit "
match_max... (1 Reply)
Hi
Input text is
some message some message some message
Expected output is
main value1 value2 value3
Any idea how to above values in square brackets using shell scripting?
many thanks. (3 Replies)