Put Your ssh pub key to your host, then you don’t need type password everytime when you ssh your host.
SSH use super high RSA algorithm, so SSH is very high security.
1, Your host(linux) must installed sshd.
- Install sshd
1
$ sudo apt-get install sshd
2, Check your host(linux)’s sshd config.
Your hots’s /etc/ssh/sshd_config must have this config and not been commanded out:
1
2
3RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys.ssh/authorized_keys file will generated when you send pubkey from your customer system. Next step.
3, Send customer computer’s pubkey to your host.
Use ssh-copy-id
- if your system is mac, you need install
ssh-copy-id
use https://github.com/beautifulcode/ssh-copy-id-for-OSX Install ssh-copy-id
1
$ curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh
then you can use this send your ssh pubkey:
1
$ ssh-copy-id user@host
eg:
1
$ ssh-copy-id haiyang@192.168.1.22
Or
You can copy your pubkey text to host’s .ssh/authorized_keys directly.
copy —> paste
Then config your customer’s ~/.ssh/config file.1
2
3
4
5Host dev_host
HostName 192.168.1.2
Port 22
User dev
IdentityFile ~/.ssh/id_rsa_dev
If you have more pubkey and hosts, just add more Host config to your ~/.ssh/config
file.
And you can connect to your host just use:1
$ ssh dev_host