Server1
communicate withServer 2
ssh-keygen [-b bits-length (default 2048)] -t algorithm-type [-f output-file-name]
$ ssh-keygen -b 2048 -t rsa -f ~/.ssh/api-key
there are 2 files created in ~/.ssh which contains
$ chmod 600 ~/.ssh/api-key
$ chmod 644 ~/.ssh/api-key.pub
scp [original-file] [remote-user]@[remote-server]:
$ scp ~/.ssh/api-key.pub myuser@192.168.1.2:
enter myuser
password
myuser
authorized_keys
$ cat ~/api-key.pub >> ~/.ssh/authorized_keys
$ chmod 644 ~/.ssh/authorized_keys
$ ssh -i ~/.ssh/api-key myuser@192.168.1.2