Question Details

Browse

SSH in Linux Shell Script

By Senthil Swamy - Jun. 30, 2008

I want to use ssh in my script, condition is and I am looking to hardcode the username and password. I tried with SSH_ASKPASS, but I can't get it to work and i dont want to go with rsa/dsa keys


Answers

Add Answer
  1. By Randy Clark on Jul. 07, 2008

    Why would you want to hard code the login/pass in your script? That is a no-no! Any reason why you would not want to use RSA? You can set up your machines with a public key exchange so you can always access it from your box for a given account.


    0 Votes
  2. By an anonymous user on Jul. 08, 2008

    One way to do this is publickey authentication. This way you won't be prompted for any password. But since you don't want to go down that road, the other option that I have had success with is using "expect". It is a separate interpreter from your shell (i.e. bash, ksh, csh) that you will have to install, but it's easy. If you google "expect ssh password" you should see many examples of how to use expect to enter your password for you.


    0 Votes
Share your knowledge