Ssh is a very convenient way to remotely command or control other devices. We use ssh to push commits to git server, to access remote server, and even to manipulate the content of our iphones and ipads. However it’s usually distributing to type your long and elusive password every time. Therefore here I would like introduce a way to create a steady relationship between your computer and the remote server you wanna connect with.
The principle is this, ssh connection establishments requires verification using the computer unique key of both devices. in order to simplify this step, we can generate a public key of your computer in advanced and which allows other to identify you. While you put that public key in the remote device as authorized key, you can kinda fast forward the process.
- open terminal and run
ssh-keygen -t dsa
.ssh/id_dsa.puband copy content inside
- open new tab in terminal and ssh server
- paste all content into
ssh-keygen -t rsa ssh b@B mkdir -p .ssh cat .ssh/id_rsa.pub | ssh b@B ‘cat >> .ssh/authorized_keys’