- I do need a key AND password
- I run multiple servers (50+), and I can't afford changing them all to no password.
- The same is true for public and private keys, would take up too much time for every server.
I tried sshpass, but it somehow messed up my SSH login with some of my units (I had to reset the known_hosts of the server). If I could modify my script to work with sshpass properly, it would be a possible solution.
I'm hoping to find, is some sort of option on ssh, that will automatically do the password; something like:
ssh -o ConnectTimeout=5 -p 'USER_PASSWORD' USER@192.168.0.*** sensors | grep Core >> sensors.txt
Or something with a small script that can sense and auto-fill (like a macro or so?) a password (half the servers have the same PWD anyway).
My second issue is that I noticed that the script sometimes hangs (Ping connects, but SSH doesn't), which requires me to wait for a timeout, or restart the script. Not sure if it's a network issue, or what, but if I restart it, sometimes it does go through.
ConnectTimeout=5 doesn't seem to work like expected. The script only stops, when the server is offline (no IP link established). When the server is online, but openssh doesn't handshake, the script hangs...