SSH (Secure Shell) is a secure network protocol used to connect to remote servers and manage them safely over a network.
It allows you to log in, run commands, and transfer files on another machine using encrypted communication.
scp and sftpssh user@server_ip
Your system acts as the SSH client, and the remote machine runs the SSH service (sshd).
The server sends its host key. The client checks it against the known_hosts file to prevent man-in-the-middle attacks.
The client and server agree on encryption algorithms and create a secure encrypted tunnel.
Authentication can be done using:
Once authenticated, a secure shell session is created where all commands and responses are encrypted.
ssh: connect to host x.x.x.x port 22: Connection timed out
Causes: Server down, firewall blocking port 22, wrong IP address.
Fix: Check server status, firewall rules, and IP address.
Permission denied (publickey)
Causes: Wrong username, incorrect key, missing public key.
Fix:
chmod 400 key.pem
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Fix:
ssh-keygen -R server_ip
Fix: Specify the key explicitly.
ssh -i key.pem user@server_ip
systemctl status sshd
systemctl start sshd