I'm new to Bash and I'm doing a for loop in a script which will ssh onto various servers (all have the same username and password) but is there a way I can bypass the password prompt to save time?
Hopefully someone can help!
I'm new to Bash and I'm doing a for loop in a script which will ssh onto various servers (all have the same username and password) but is there a way I can bypass the password prompt to save time?
Hopefully someone can help!
 
    
    Password authentication is inferior to public-key authentication security-wise. While you could achieve what you want with sshpass, I recommend switching to public key authentication and employ ssh-agent(1) to not reenter passphrases everytime. 
Here's how you would setup ssh-agent:
In ~/.ssh/config for each server entry add ForwardAgent yes field, or if you want to do it globally, just add
Host *
    ForwardAgent yes
Then employ the ssh-agent(1) like this:
$ eval `ssh-agent`
$ ssh-add /home/test/.ssh/id_rsa_1
$ ssh-add /home/test/.ssh/id_rsa_2
