Wednesday, June 22, 2022

SSH Basics

 We learned a little bit about the SSH protocol and how to use the ssh program to connect to a remote server.

SSH protocol was introduced for secure communication using the pub- lic key encryption on the network. OpenSSH is a collection of programs implementing this protocol and available to us.

Connecting to a remote server can be as easy as running ssh $USER@$HOST. In the case we create a server with password authentication, we can use ssh-copy-id to put the public key to the server and take advantage of SSH-keys only access.

We learned about SSH keys management. We can find our keys in ~/.ssh, generate new ones with ssh-keygen. We explored how ~/.ssh/authorized_keys is used for authorizing access using these keys and how SSH host keys are stored in ~/.ssh/known_hosts.

scp and sftp are the go-to tools for secure file transfer over SSH. Although using scp has some security implications given its original design, it’s safe to use in simple commands. rsync is another popular option.