could not send commands SSH session with Net::SSH::Expect

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting could not send commands SSH session with Net::SSH::Expect
# 1  
Old 08-28-2009
could not send commands SSH session with Net::SSH::Expect

I am using Net::SSH::Expect to connect to the device(iLO) with SSH. After the $ssh->login() I'm able to view the prompt, but not able to send any coommands.

With the putty I can connect to the device and execute the commands without any issues.

Here is the sample script

my $ssh = Net::SSH::Expect->new (
'host' => $host,
'user' => $login,
'password' => $passwd,
'timeout' => 15,
'raw_pty' => 1,
'log_file' => "iloExpect.log",
print "Login Failed with the Host = $host Login $login and Password $passwd";
if($connect !~ /$prompt/i)
print "\nCould not get the prompt \n";
print "\nSending the command [$cmd]\n";
my $output = $ssh->exec('help');
print "\nOutput [$output]\n";

Thanks in Advance,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh = ssh expect and keep everything not change include parameter postion

I have write a script which contains ssh -p 12345 dcplatform@ ssh -p 5555 "$CMD" ssh root@$GUEST_IP "$CMD" before I use public key, it works well, now I want to change to "expect", BUT I don't want to change above code and "parameter position" I can post a... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

2. Shell Programming and Scripting

set Net:SSH:Expect timeout and set it again.

SSHing into a machine can take a few seconds, but after I'm in, the commands return quickly. I was wondering if the timeout setting can be changed once I'm logged into the machine. Does anyone know if this can be set on the fly? The problem here is, if I have to set timeout = 10, it'll take 10... (1 Reply)
Discussion started by: mrwatkin
1 Replies

3. UNIX for Dummies Questions & Answers

SSH session

I ran a job using SSH and then used screen command followed by space bar. Then I ran the job. But after some hours, the internet connection was lost.This had happened to me before. I used to run the whole job again. Today I came across the fact that I could restart the jobs without having to do it... (2 Replies)
Discussion started by: nellierd
2 Replies

4. Shell Programming and Scripting

Send Remote Commands via SSH with variables

Hi there I found the Command to send commands to other servers like: sv01> ssh user@sv02 'ps -ef' But I cant use Variables from a script i want to execute on another server like: sv01> ssh user@sv02 'cd $SCRIPTHOME' although the variable is set on sv01. How can I run commands on sv02 with... (2 Replies)
Discussion started by: DarkSwiss
2 Replies

5. Shell Programming and Scripting

Bash commands to an 'ssh' within an ssh'

I've struggled to find a solution to this problem from searching so I thought I'd write a post to see what can be done. I'm attempting to connect and run commands on 'server2' but because of security limitations I cannot access it directly. I can however ssh into 'server1' and then into... (7 Replies)
Discussion started by: mcintosh.jamie
7 Replies

6. HP-UX

ssh session getting hung (smilar to hpux telnet session is getting hung after about 15 minutes)

Our network administrators implemented some sort of check to kill idle sessions and now burden is on us to run some sort of keep alive. Client based keep alive doesn't do a very good job. I have same issue with ssh. Does solution 2 provided above apply for ssh sessions also? (1 Reply)
Discussion started by: yoda9691
1 Replies

7. Shell Programming and Scripting

Expect, SSH and multiple passed commands

Hey Everyone, I have found this script online that has almost all the features I am looking for. However, I do not know enough expect to debug the problem. First, it Traps out after it collects the user's password. I do not know... (0 Replies)
Discussion started by: patchsmyle
0 Replies

8. Shell Programming and Scripting

Make ssh and send commands

Hi, I'm trying to make an SSH into a SGSN node and collect some commands printouts.:confused: I really don't know how this can be done. I think it must be like this: #!/bin/bash ssh user@ Then I must enter the password, but I don't know how to do it, I tried with: echo... (3 Replies)
Discussion started by: nagomes
3 Replies

9. Shell Programming and Scripting

scripting an ssh session?

I know the root login/password for a machines, and I want to automate some commands like this from each: ssh root@remoteHost1 "tail /var/log/messages" ssh root@remoteHost2 "tail /var/log/messages" ssh root@remoteHost3 "tail /var/log/messages" ssh root@remoteHost4 "tail /var/log/messages" ssh... (2 Replies)
Discussion started by: jjinno
2 Replies

10. UNIX for Dummies Questions & Answers

is it possible to ssh within an ssh session?

i have a home network in which one computer can be sshed into from the internet. inside this ssh session, i cannot ssh into another computer on the internal network (LAN) i get the following error: pseudo-terminal will not be alocated because stdin is not a terminal any suggestions would be... (4 Replies)
Discussion started by: noamkrief
4 Replies
Login or Register to Ask a Question
bssh/bvnc/bshell(1)					      General Commands Manual					       bssh/bvnc/bshell(1)

bssh/bvnc/bshell - Browse for SSH/VNC servers on the local network SYNOPSIS
bssh bvnc bshell DESCRIPTION
bssh/bvnc/bshell browses for SSH/VNC servers on the local network, shows them in a GUI for the user to select one and finally calls ssh/vncviewer after a selection was made. If the binary is called as bssh only ssh servers will be shown. If the binary is called as bvnc only VNC servers will be shown. If the binary is called as bshell both VNC and SSH servers are shown. OPTIONS
-s | --ssh Browse for SSH servers (and only SSH servers) regardless under which name the binary is called. -v | --vnc Browse for VNC servers (and only VNC servers) regardless under which name the binary is called. -S | --shell Browse for both VNC and SSH servers regardless under which name the binary is called. -d | --domain= DOMAIN Browse in the specified domain. If omitted bssh/bvnc/bshell will browse in the default browsing domain (usually .local) -h | --help Show help. SEE ALSO
avahi-browse(1), ssh(1), vncviewer(1) COMMENTS
This man page was written using xml2man(1) by Oliver Kurth. Manuals User bssh/bvnc/bshell(1)