What is SSH?
It is a security shell communication protocol and enables to computers to communicate. SSH is based on a client-server architecture where the user system is the client and the remote system being managed is the server.
Command exemple to connec a server:
Use -v to verbose mode.
SSH server
SSH default port is 22, can be changed on the config file at /etc/sshd_config. It's possible to customize not only the port, but also listen address, max sessions, public keys authentication, password authentication etc.
Authorized keys
Authorized keys are stored at ~/.ssh/autorized_keys. It is possible to add direct at this file a public key or add from client with this command:
Find out more here:
https://manpages.ubuntu.com/manpages/trusty/man1/ssh-copy-id.1.html
SSH client
Guess what? SSH client default port is 22 as well, and can be changed too at /etc/ssh_config. As the server, it's possible to customize a bunch of configuration from port to authentication mode.
It is possible to simplify adding a file named config at ~/.ssh/ for exemple (~/.ssh/config):
Host bastian //I chose bastian, but you can give the name you want
Hostname 192.168.0.3 //IP address
Port 7000 //Change the port if you did at the server
User root //User name
This way, the command will be:
ssh bastian
SSH keys
I need to be honest, at my fist job as a system administrator I had no idea how ssh works, and droped my jaw seeing a colleague using ssh-key connecting to a server. I needed to find out how it works and than I searched the internet and found a couple of tutorials and one of the best was this one:
Creating keys
Or
ssh-keygen //with no arguments will create rsa keys at ~/.ssh/id_rsa
How do I know my running key?
To show your identity key:
Error connecting to agent
If the ssh-agent is not running, you need to start it:
What if I have no identity key?
if the agent has no identities, you can set your identity key:
IMPORTANT NOTICE: This image was Image by pch.vector on Freepik
One thought to “SSH”
Comments are closed.