OpenSSH (Open Secure Shell) is a free and open-source suite of security-related network connectivity tools. It provides secure access to remote systems, ensuring encrypted data transfer and authentication.
Key Features:
- Secure Remote Access: OpenSSH enables secure remote login, file transfer, and port forwarding.
- Encryption: Uses cryptographic techniques (e.g., AES, RSA, ECDSA) to protect data.
- Authentication: Supports password, public key, and Kerberos authentication.
- Secure File Transfer: Includes SFTP (Secure File Transfer Protocol) and SCP (Secure Copy) for secure file transfers.
Components:
- ssh: Remote login client.
- sshd: Remote login server.
- scp: Secure file copy client.
- sftp: Secure file transfer client.
- ssh-keygen: Tool for generating public/private key pairs.
Benefits:
- Security: Protects against eavesdropping, tampering, and man-in-the-middle attacks.
- Flexibility: Supports various authentication methods and encryption algorithms.
- Cross-platform: Available on multiple operating systems (Linux, macOS, Windows).
Common Use Cases:
- Remote System Administration
- File Transfer
- Secure Tunnels (Port Forwarding)
Installation
Note:
Ubuntu Server should already have OpenSSH server pre-installed.
Ubuntu Desktop may not have OpenSSH server pre-installed.
1) Install the package
sudo apt update && sudo apt upgrade
sudo apt install openssh-server
2) Start the SSH Server
sudo systemctl enable --now ssh
3) Check the status
sudo systemctl status ssh
4) Configure the firewall
Check this article for how to protect your OpenSSH server:
Protect your OpenSSH server on Ubuntu using UFW
5) Connect to the server
Default SSH Port is 22.
ssh <username>@<ip-address>
OR use a tool like PuTTY
Download from: https://putty.org/
6) If you want to change the port number (Optional)
Create the backup of the original settings:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original
Open the config file:
sudo nano /etc/ssh/sshd_config
Change the port number:
Port 32501
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
Restart the SSH service:
sudo systemctl restart ssh
Connect to the server:
ssh -p <port-number> <username>@<ip-address>
Useful links: