Professional Web Applications Themes

shell stdin redirection: possible for ssh-password input? - FreeBSD

Hi, I must connect to another computer with ssh, but this computer does not allow password-less connections (i.e. the administrator has disabled the use of id_dsa.pub, authorized_key etc.) I'm trying to write a script to do the ssh connection automatically, but the script always prompts for the password. Can I construct an input redirect, so that I can feed the password via my script? I tried following: #!/bin/sh ssh myISP <<EOF myPassWord EOF but that doesn't work. I take for granted that my password will be there in clear text! Are there other options? Thanks, Rob. __________________________________________________ Do You Yahoo!? ...

  1. #1

    Default shell stdin redirection: possible for ssh-password input?


    Hi,

    I must connect to another computer with ssh, but
    this computer does not allow password-less
    connections (i.e. the administrator has disabled
    the use of id_dsa.pub, authorized_key etc.)

    I'm trying to write a script to do the ssh connection
    automatically, but the script always prompts for
    the password. Can I construct an input redirect, so
    that I can feed the password via my script?
    I tried following:

    #!/bin/sh
    ssh myISP <<EOF
    myPassWord
    EOF

    but that doesn't work.

    I take for granted that my password will be there
    in clear text! Are there other options?

    Thanks,
    Rob.

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.
    Rob Guest

  2. #2

    Default Re: shell stdin redirection: possible for ssh-password input?

    Rob wrote:
     
    Rob,

    Check out expect. There's even a Perl module for it. Expect is the bad
    old way we used to handle such problems. It is this funky sub-language
    designed for completing interactive sessions in an automated way.

    Also, please post from a legitimate e-mail address, in case someone were
    sufficiently good-natured to hit "Reply" instead of "Reply All."

    Good luck.

    -danny
    Danny Guest

  3. #3

    Default Re: shell stdin redirection: possible for ssh-password input?

    Danny Howard wrote: 

    This is exactly what I need and it works beautifully.
    Thanks so much!
     

    It IS a legitimate email address; it may look funny,
    but I suppose that's allowed :).

    Regards,
    Rob.

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.
    Rob Guest

Similar Threads

  1. Replies: 2
    Last Post: July 13th, 04:08 PM
  2. $_POST behavior from input=submit vs input-type=button
    By Victor A. Cuya in forum PHP Development
    Replies: 2
    Last Post: May 11th, 03:42 PM
  3. What is the source of my input, file or STDIN?
    By pgregory@micron.com in forum PERL Beginners
    Replies: 15
    Last Post: January 7th, 09:08 PM
  4. Replies: 0
    Last Post: December 31st, 06:40 PM
  5. Shell password change with PHP ?
    By lecichy in forum PHP Development
    Replies: 2
    Last Post: October 19th, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139