09-26-2016
Have you considered using SSH keys to automate the login? This would be better than trying to work around ssh with expect.
Additionally, your script is vulnerable to people reading it as your password will be visible.
The ssh design is to be secure, so you would be better to exploit that rather than to circumvent it.
Kind regards,
Robin
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I've written a shell script to alter a particular preference file on OS X (10.3.9), which works fine (tested by running the script from the terminal sat in front of the box).
Problem is, I now have to run this script remotely across a number of machines via remote desktop, so where I've used the... (1 Reply)
Discussion started by: Brad_GNET
1 Replies
2. Shell Programming and Scripting
Could someone please help me...I have an expect script. There's a need for a log in during the script and a password is required...right now the password is just a variable in the expect script...what would be the best way to put that in an encrypted flat file and have the expect script pull the... (2 Replies)
Discussion started by: cubs0729
2 Replies
3. Shell Programming and Scripting
I need to create an automated script where I have to use sudo to switch to multiple user so the script stops and prompts for password, Is there a way I can provide the password in same command only?
Remember that, I cannot disable the password settings of sudo as I dont have rights. (4 Replies)
Discussion started by: gauravgrover50
4 Replies
4. OS X (Apple)
I'm making a script that will be a double clickable .command file and I need it to prompt for the users admin password.
So far I have:
if ]; then
sudo -p "Please enter your admin password: " date 2>/dev/null 1>&2
if ; then
echo "You entered an invalid password... (2 Replies)
Discussion started by: PatGmac
2 Replies
5. Shell Programming and Scripting
I'm using rsync with the "-e ssh" option so of course it asks for a password using a prompt. Is there a way to tell a script to expect a prompt, wait for it, and give a password when it arrives?
There is a way to give rsync a password as part of its options using a file, but it only works with... (2 Replies)
Discussion started by: davidstvz
2 Replies
6. Shell Programming and Scripting
Hi
Thanks for this amazing forum first, I've been searching answers in it for problems that I've encountered at work.
The only problem I haven't been able to find a fix for, is a ever waiting for prompt problem in Expect when encounter a $ prompt.
I usually set the timeout to -1 cause the... (2 Replies)
Discussion started by: Ikaro0
2 Replies
7. Shell Programming and Scripting
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)
Discussion started by: urello
3 Replies
8. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data: I am trying to write a shell script that prompts the user for the password which is "lux" once the correct password... (4 Replies)
Discussion started by: Emin_Em
4 Replies
9. Shell Programming and Scripting
Hi Team,
I need password prompt between this script .i want to need put password manually. Instead of adding password in script .
Script pause till input password and resume again.
#!/usr/bin/expect
set ip
spawn telnet $ip
expect "login:"
send "USR\r"
expect "*assword*"... (3 Replies)
Discussion started by: Ganesh Mankar
3 Replies
10. Shell Programming and Scripting
I have a simple Expect script to power a system on and off in an endless loop looking for an ERROR message at which point the script should exit. But I need to skip the first 60 seconds after each power on or off and not exit if there are ERROR messages during that time. I thought I could use... (0 Replies)
Discussion started by: David_Gilhooly
0 Replies
LEARN ABOUT CENTOS
fence_ilo_mp
FENCE_AGENT(8) System Manager's Manual FENCE_AGENT(8)
NAME
fence_ilo_mp - Fence agent for HP iLO MP
DESCRIPTION
fence_ilo_mp accepts options on the command line as well as from stdin. Fenced sends parameters through stdin when it execs the agent.
fence_ilo_mp can be run by itself with command line options. This is useful for testing and for turning outlets on or off from scripts.
Vendor URL: http://www.hp.com
PARAMETERS
-a, --ip=[ip]
IP Address or Hostname This parameter is always required.
-l, --username=[name]
Login Name This parameter is always required.
-p, --password=[password]
Login password or passphrase
-x, --ssh
SSH connection
-c, --command-prompt=[prompt]
Force Python regex for command prompt (Default Value: ['MP>', 'hpiLO->'])
-u, --ipport=[port] TCP/UDP port to use (default 23, 22 if --ssh
TCP/UDP port to use for connection with device (Default Value: 23)
-4, --inet4-only
Forces agent to use IPv4 addresses only
-6, --inet6-only
Forces agent to use IPv6 addresses only
-S, --password-script=[script]
Script to retrieve password
-k, --identity-file=[filename]
Identity file for ssh
--ssh-options=[options]
SSH options to use
-o, --action=[action]
Fencing Action (Default Value: reboot)
-v, --verbose
Verbose mode
-D, --debug-file=[debugfile]
Write debug information to given file
-V, --version
Display version information and exit
-h, --help
Display help and exit
--power-timeout=[seconds]
Test X seconds for status change after ON/OFF (Default Value: 20)
--shell-timeout=[seconds]
Wait X seconds for cmd prompt after issuing command (Default Value: 3)
--login-timeout=[seconds]
Wait X seconds for cmd prompt after login (Default Value: 5)
--power-wait=[seconds]
Wait X seconds after issuing ON/OFF (Default Value: 5)
--delay=[seconds]
Wait X seconds before fencing is started (Default Value: 0)
--retry-on=[attempts]
Count of attempts to retry power on (Default Value: 1)
ACTIONS
on Power on machine.
off Power off machine.
reboot Reboot machine.
status This returns the status of the plug/virtual machine.
list List available plugs with aliases/virtual machines if there is support for more then one device. Returns N/A otherwise.
monitor
Check the health of fence device
metadata
Display the XML metadata describing this resource.
STDIN PARAMETERS
ipaddr IP Address or Hostname This parameter is always required.
login Login Name This parameter is always required.
passwd Login password or passphrase
secure SSH connection
cmd_prompt
Force Python regex for command prompt (Default Value: ['MP>', 'hpiLO->'])
ipport TCP/UDP port to use for connection with device (Default Value: 23)
inet4_only
Forces agent to use IPv4 addresses only
inet6_only
Forces agent to use IPv6 addresses only
passwd_script
Script to retrieve password
identity_file
Identity file for ssh
ssh_options
SSH options to use
action Fencing Action (Default Value: reboot)
verbose
Verbose mode
debug Write debug information to given file
version
Display version information and exit
help Display help and exit
power_timeout
Test X seconds for status change after ON/OFF (Default Value: 20)
shell_timeout
Wait X seconds for cmd prompt after issuing command (Default Value: 3)
login_timeout
Wait X seconds for cmd prompt after login (Default Value: 5)
power_wait
Wait X seconds after issuing ON/OFF (Default Value: 5)
delay Wait X seconds before fencing is started (Default Value: 0)
retry_on
Count of attempts to retry power on (Default Value: 1)
fence_ilo_mp (Fence Agent) 2009-10-20 FENCE_AGENT(8)