Use SSH-Agent to automate inputting passphrase on key-pair authentication.
[1] It’s necessarry to set key-pair first.
[2] How to use SSH-Agent.
# start SSH-Agent
[cent@localhost ~]$ eval `ssh-agent`
Agent pid 2168
# add Identity
[cent@localhost ~]$ ssh-add
Enter passphrase for /home/cent/.ssh/id_rsa:
Identity added: /home/cent/.ssh/id_rsa (/home/cent/.ssh/id_rsa)
# confirm
[cent@localhost ~]$ ssh-add -l
2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:4c:b2 /home/cent/.ssh/id_rsa (RSA)
# try to conenct with SSH without passphrase
[cent@localhost ~]$ ssh node01.local hostname
node01.local
# exit from SSH-Agent
[cent@localhost ~]$ eval `ssh-agent -k`
Agent pid 2168 killed