I am trying to write a bash script to login to a range of servers and execute some commands, the server which is going to be running the bash script doesn't have EXPECT or SSHPASS installed and I am unable to install it.

I am looking for either a way for the script to automate the login without BASH or SSHPASS.

Alternatively the script pauses at the point where SSH wants the password the user running the script then manually enters the password and then the script resumes to run the commands on that device. This then repeats for each device, I know this isn't very efficient but it isn't really a problem.

I have searched online for a couple of hours but everything seems to relate to 3rd party tools that I can' install.


  • 3
    ssh already prompts for a password if one is necessary. What is the problem you are having? – Michael Hampton Nov 13 '15 at 13:23

The only choices that I know for use ssh without password are essentially 3

  1. you can pre-authorize your systems on others (quick & dirty no high secure)

    On your client login such some specific user ex: snmc

    ssh-keygen -t dsa -b 1024 
    ssh-copy-id -i ~/.ssh/id_dsa.pub  snmc@server
    <insert your password>
    ssh server
  2. with an identity pre share certificates (more secure) like this

    ssh -i identity.pem root@server-address

    It's a little bit complicated to configure please search on internet

  3. Using a centralized a identity manager systems like RADIUS or KERBEROS and configuring pam modules it's high secure as well but a little bit articulated but it's the best for me.

I hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.