Ruby executing shell commands

Discussion in 'Ruby' started by Guilherme Viteri, Sep 8, 2010.

  1. 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/.
    Guilherme Viteri, Sep 8, 2010
    #1
    1. Advertising

  2. Guilherme Viteri

    Walton Hoops Guest

    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.
    Walton Hoops, Sep 8, 2010
    #2
    1. Advertising

  3. Guilherme Viteri

    Roger Pack Guest


    > 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/.
    Roger Pack, Sep 8, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kentor

    executing shell commands from c?

    Kentor, Mar 19, 2007, in forum: C Programming
    Replies:
    10
    Views:
    772
    Ben Pfaff
    Mar 20, 2007
  2. mlay

    executing shell commands in asp

    mlay, Nov 9, 2003, in forum: ASP General
    Replies:
    2
    Views:
    179
    Aaron Bertrand [MVP]
    Nov 9, 2003
  3. Kevin Skrenes
    Replies:
    6
    Views:
    207
    Robert Klemme
    Mar 17, 2007
  4. vhaerun vh
    Replies:
    16
    Views:
    274
    Eleanor McHugh
    Sep 8, 2009
  5. Murugesh
    Replies:
    5
    Views:
    178
Loading...

Share This Page