This question already has an answer here:
- Shell Script for logging into a ssh server 10 answers
Im struggling with how to do things.
My goal is that when in on my jumphost type ssh router1, then it will ssh to the router, and at the same time run an expect script to fill in my password from a password file (which ofcource is readonly to me) preferably it should send it encrypter so that it cant be picked up by anyone.
I have managet to get an expect script to work, but i dont want to have a gazillion expect scripts in my folder (for the amount of routers we have).
Im thinking it could be done using alias commands? I already have alias commands setup so that if i type router1 it will automatically ssh to that particular router.
(i got a message that this was a duplicate, but i have been unsucessfull in finding the duplicate question, so I am gonna try to explain further: Lets say that we, in my company have 100 routers. for now i have made alias'es so when i type router1 in my prompt, it will do ssh router1. I want to try to extend that functionality and shave off a few precious ms of time, by filling in the password automatically.
So in other words im looking for a way to combine alias with an expect script (and possibly a bash script if needed) and i am shockingly bad at any scripting
Hope someone can help :)