# Net-Ssh

**URL:** <https://www.ruby-forum.com/t/net-ssh/159926>\
**Category:** Ruby\
**Created:** [February 10, 2009, 3:00am UTC](https://www.ruby-forum.com/t/net-ssh/159926 "2009-02-10T03:00:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GonSSSSalo\_Pires](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@GonSSSSalo\_Pires](https://www.ruby-forum.com/u/GonSSSSalo_Pires)\
**Post date:** [February 10, 2009, 3:00am UTC](https://www.ruby-forum.com/t/net-ssh/159926/1 "2009-02-10T03:00:43Z")

</div>

Hi there,

I’m trying to develop a script that will use net-ssh to performe some  
routine commands on a remote server.

But i’ve a problem when i give a comand that will change the remote  
system  
prompt. I think ruby is expecting the default caracter “#”, but the  
command  
will change it to “\>”, and the script don’t run.

require ‘net/ssh’  
Net::SSH.start(‘172.16.20.78’, ‘root’, :password =\> “passwd” ) do |  
ssh|  
output = ssh.exec!(“su - sysad”)  
end

Could you please tell me I could I change the “expected” prompt?

Best regards,  
GP

---

<div class="post-metadata">

**Author:** ![GonSSSSalo\_Pires](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@GonSSSSalo\_Pires](https://www.ruby-forum.com/u/GonSSSSalo_Pires)\
**Post date:** [February 12, 2009, 9:28pm UTC](https://www.ruby-forum.com/t/net-ssh/159926/2 "2009-02-12T21:28:20Z")

</div>

> Hi there,

---

<div class="post-metadata">

**Author:** ![GonSSSSalo\_Pires](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@GonSSSSalo\_Pires](https://www.ruby-forum.com/u/GonSSSSalo_Pires)\
**Post date:** [February 15, 2009, 9:51pm UTC](https://www.ruby-forum.com/t/net-ssh/159926/3 "2009-02-15T21:51:30Z")

</div>

GonÃ§alo Pires wrote:

> Hi there,
> 
> I’m trying to develop a script that will use net-ssh to performe some  
> routine commands on a remote server.
> 
> But i’ve a problem when i give a comand that will change the remote  
> system  
> prompt. I think ruby is expecting the default caracter “#”, but the  
> command  
> will change it to “\>”, and the script don’t run.
> 
> require ‘net/ssh’  
> Net::SSH.start(‘172.16.20.78’, ‘root’, :password =\> “passwd” ) do |  
> ssh|  
> output = ssh.exec!(“su - sysad”)  
> end
> 
> Could you please tell me I could I change the “expected” prompt?

I don’t think raw Net::SSH waits for a prompt. It works at a lower level  
of the SSH protocol protocol units.

If you want an expect-like interface, you could try Net::SSH::Telnet  
(separate package). This is something I wrote to give an API almost  
identical to Net::Telnet.
