Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby executing shell commands

Reply
Thread Tools

Ruby executing shell commands

 
 
Guilherme Viteri
Guest
Posts: n/a
 
      09-08-2010


Hi All,

My scenario seems like: 1 host machine and many others virtual machines.
(exampling: Windows as host and VM Linux Ubuntu).

I'm looking for a Ruby implementation that manipulates the IPTables on
this virtual machines. I mean the host machine will have a ruby program
that will interact to these virtual machines.

I've figured out many sites I've found a library Net-ssh.

When I've tried to run an 'iptables -L', it shows me 'no tty present and
no askpass program specified'. And looking at Net-ssh API examples to
perform shell interaction, however I can't run any example...

I've tried many other things too, all of them was unsuccessful.

Of course I'm ruby newbie. =)

Could you guys help me please ?? I will really appreciate that =P

Thanks a lot
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Walton Hoops
Guest
Posts: n/a
 
      09-08-2010
On 9/8/2010 6:25 AM, Guilherme Viteri wrote:
>
> Hi All,
>
> My scenario seems like: 1 host machine and many others virtual machines.
> (exampling: Windows as host and VM Linux Ubuntu).
>
> I'm looking for a Ruby implementation that manipulates the IPTables on
> this virtual machines. I mean the host machine will have a ruby program
> that will interact to these virtual machines.
>
> I've figured out many sites I've found a library Net-ssh.
>
> When I've tried to run an 'iptables -L', it shows me 'no tty present and
> no askpass program specified'. And looking at Net-ssh API examples to
> perform shell interaction, however I can't run any example...
>
> I've tried many other things too, all of them was unsuccessful.
>
> Of course I'm ruby newbie. =)
>
> Could you guys help me please ?? I will really appreciate that =P
>
> Thanks a lot

An example program doing what you ask:
http://gist.github.com/570440

sample run:

Enter host: <entered hostname>
Enter username: <entered username>
Enter password: <entered password>
iptables v1.4.4: can't initialize iptables table `filter': Permission
denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
work complete!

Note: for obvious reasons I didn't login as root, thus the error.

 
Reply With Quote
 
 
 
 
Roger Pack
Guest
Posts: n/a
 
      09-08-2010

> When I've tried to run an 'iptables -L', it shows me 'no tty present and
> no askpass program specified'. And looking at Net-ssh API examples to
> perform shell interaction, however I can't run any example...


maybe you need to login as root, or allow your current user to sudo
without password the iptables -L command.
-r
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing system commands in threads under Ruby 1.8.6 vhaerun vh Ruby 16 09-08-2009 10:59 AM
executing shell commands from c? Kentor C Programming 10 03-20-2007 04:00 PM
Executing shell commands from Ruby... again. Kevin Skrenes Ruby 6 03-17-2007 09:00 AM
executing commands in the same shell in Windows using Perl Murugesh Perl Misc 5 12-07-2005 04:25 PM
executing shell commands in asp mlay ASP General 2 11-09-2003 03:25 PM



Advertisments