I have this bash file, which asks for IP, password, etc. for OpenSSH to a device.
Now, if i use ssh root@ip, i have to enter the password. This is reall
The proper way to do this without storing passwords in plaintext on your machine is with ssh. First run:
ssh-keygen
This will generate a new SSH key in ~/.ssh/id_rsa.pub. After that simply run:
ssh-copy-id user@my.server.com
If you're on OS X or another machine that does not have "ssh-copy-id" there are one-line alternatives such as this one:
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
Ultimately you just need to append the contents of ~/.ssh/id_rsa.pub on your local machine to ~/.ssh/authorized_keys on the remote server. How you do that is up to you, the above are just quick shortcuts to do that.