sshpass does not work. Is there an alternative?

20,859

Solution 1

It didn't look like anyone mentioned expect yet: http://linux.die.net/man/1/expect

Solution 2

Here is its alternative available:

https://stackoverflow.com/questions/714915/using-the-passwd-command-from-within-a-shell-script

but this is NEVER recommended as it is a serious security weakness and can lead your system open to anyone. better to setup password-less ssh login to the machines on which you want to run specific commands.

Share:
20,859

Related videos on Youtube

bulleric
Author by

bulleric

Updated on September 18, 2022

Comments

  • bulleric
    bulleric over 1 year

    I use a small programm = sshpass to use ssh in a script to execute commands on linux routers

    Is there a alternative to sshpass because sshpass works at the moment not correctly (Bugs) - incompatibilities with the sshclient

  • bulleric
    bulleric over 12 years
    it not work because the --stdin works only with passwd not with ssh it gives an error. i know the security weakness but the client and the router are in a vpn network and nobody from outsite can access to this clients.
  • Farhan
    Farhan over 12 years
    what about keyless ssh authentication? isnt that possible?
  • bulleric
    bulleric over 12 years
    sadly not because the root system is read only and a cant send a key file to this system. I will write a small script was execute a script to update the router configuration over ssh
  • bulleric
    bulleric over 12 years
    ssh got no option --stdin when i test it i got an error : Pseudo-terminal will not be allocated because stdin is not a terminal.
  • 178024
    178024 almost 9 years
    Similar and maybe easier python-pexpect and expect4j available too, you have my upvote either. Yours might be the accepted answer.