# Net::SSH Force tty

**URL:** <https://www.ruby-forum.com/t/net-ssh-force-tty/140954>\
**Category:** Ruby\
**Created:** [June 20, 2008, 2:56am UTC](https://www.ruby-forum.com/t/net-ssh-force-tty/140954 "2008-06-20T02:56:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shawnjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@shawnjan](https://www.ruby-forum.com/u/shawnjan)\
**Post date:** [June 20, 2008, 2:56am UTC](https://www.ruby-forum.com/t/net-ssh-force-tty/140954/1 "2008-06-20T02:56:26Z")

</div>

Hey guys,

I was wondering if there was a way using the Force pseudo-tty  
allocation. If I was just to use SSH, I would use the -t flag, but I  
can’t seem to find a solution for Ruby anywhere. Any help would be  
appreciated!

Shawn

---

<div class="post-metadata">

**Author:** ![shawnjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@shawnjan](https://www.ruby-forum.com/u/shawnjan)\
**Post date:** [June 20, 2008, 8:16am UTC](https://www.ruby-forum.com/t/net-ssh-force-tty/140954/2 "2008-06-20T08:16:08Z")

</div>

Umm… Ruby isn’t a shell. Can you please explain what you want to do,  
exactly?

2008/6/20 Shawn J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![shawnjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@shawnjan](https://www.ruby-forum.com/u/shawnjan)\
**Post date:** [June 20, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/net-ssh-force-tty/140954/3 "2008-06-20T20:00:30Z")

</div>

Bryan JJ Buckley wrote:

> Umm… Ruby isn’t a shell. Can you please explain what you want to do,  
> exactly?
> 
> 2008/6/20 Shawn J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

Well, I want to use Net::SSH with ruby to excecute some commands via  
ssh, but I need the to force the tty. IF I was using a shell, I could  
just type ssh -t, so I was wondering if there was a way to do this with  
the ssh ruby library.

---

<div class="post-metadata">

**Author:** ![shawnjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@shawnjan](https://www.ruby-forum.com/u/shawnjan)\
**Post date:** [June 20, 2008, 8:27pm UTC](https://www.ruby-forum.com/t/net-ssh-force-tty/140954/4 "2008-06-20T20:27:24Z")

</div>

2008/6/20 Shawn J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Well, I want to use Net::SSH with ruby to excecute some commands via  
> ssh, but I need the to force the tty. IF I was using a shell, I could  
> just type ssh -t, so I was wondering if there was a way to do this with  
> the ssh ruby library.

It sounds like you need to send a pty request - take a look at:

[http://net-ssh.rubyforge.org/ssh/v2/api/index.html](http://net-ssh.rubyforge.org/ssh/v2/api/index.html)

and search for “request\_pty” (assuming you’re on the current v2  
Net::SSH). You might also want to look at Capistrano, for an example  
of how this is used - it has a “force pty” option, so you should be  
able to see what that does.

Chris.
