Re: how can I input password in popen("ssh...") ?

From: Robert Hajime Lanning (robert.lanning_at_gmail.com)
Date: 06/28/05

  • Next message: Nathan Zabaldo: "No longer can connect"
    Date: Tue, 28 Jun 2005 09:08:49 -0700
    To: secureshell@securityfocus.com
    
    

    For security reasons, ssh opens /dev/tty for reading user input (like
    passwords).

    You will need to use something like "expect" to script ssh sessions.

    On 6/27/05, huang bo <bhuang@qubit-star.com> wrote:
    > Hello!
    >
    > I'm new to openssh.I used sshv2 with OpenSSH_3.8.1p1 and I can only use password authentication
    > in my server.
    >
    > I forked a process to execute ssh , but I can't input password, how can I do it ?
    >
    > Below is my code:
    >
    > char *passwd = "xxxxxx\n"
    > fp = popen("/usr/bin/ssh falls@192.168.10.234 ls /etc", "w");
    > sleep(1)
    > if ( fp )
    > fwrite(passwd , strlen(passwd) , 1 ,fp) // enter password here
    >
    >
    > Best Regards
    > falls huang
    >

    -- 
    END OF LINE
           -MCP
    

  • Next message: Nathan Zabaldo: "No longer can connect"