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.
Related videos on Youtube
Author by
bulleric
Updated on September 18, 2022Comments
-
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 over 12 yearsit 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 over 12 yearswhat about keyless ssh authentication? isnt that possible?
-
bulleric over 12 yearssadly 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 over 12 yearsssh 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 almost 9 yearsSimilar and maybe easier
python-pexpect
andexpect4j
available too, you have my upvote either. Yours might be the accepted answer.