How to connect to ssh server without needing a password everytime
Recently I was involved in a project which required me to connect to 2 servers at the client location using SSH; which is fun and dandy but the trouble rises when I have to (being the laziest person I know) enter the password every-time i want to access the server.
So I wanted some way where I didn’t have to enter the password every-time I connect.
I did a lot of research and finally found a simple solution.
I needed to install a program called sshpass it allows us to pass the password to the ssh program.
so the command now becomes
sshpass ‘<password>’ ssh myId@someIP
don’t forget to use the single quotes to enclose the password.
This way I could put this line in a .sh file and call it every-time I needed to connect, needless to say, its my responsibility to keep the file away from unauthorized access.
But a nifty solution nevertheless.