SSH

From Pulsed Media Wiki
Revision as of 14:02, 19 May 2025 by Gallogeta (talk | contribs) (Guides: Information)

SSH (Secure Shell)

SSH (Secure Shell) is a cryptographic network protocol that allows secure communication between two networked devices. It is most commonly used to log into remote systems and execute commands over an encrypted connection. SSH is a foundational tool in system administration, server management, and remote file transfers.

SSH replaces older, insecure protocols like Telnet and rlogin by encrypting all data exchanged between the client and server, including passwords, commands, and file transfers.

Key Features

  • **Encrypted communication** – Prevents eavesdropping and man-in-the-middle attacks
  • **Remote shell access** – Run commands on remote systems
  • **Port forwarding/tunneling** – Securely forward ports between systems
  • **Public key authentication** – Log in without passwords using cryptographic keys
  • **File transfer support** – Via built-in tools like `scp` and `sftp`

Default Port

  • SSH operates on **TCP port 22** by default.

Common Usage

SSH is used for:

  • Managing remote Linux or Unix-based servers
  • Accessing seedboxes, cloud instances, and VPS
  • Securely copying files between machines
  • Tunneling traffic for applications or databases
  • Automation with shell scripts or cron jobs

Basic SSH Command

 ssh username@hostname


Example:


 ssh user@192.168.1.100


This connects to the host at IP `192.168.1.100` using the specified username.

SSH Key Authentication

SSH supports login via a key pair (public/private):

1. Generate keys:


 ssh-keygen -t rsa -b 4096


2. Copy the public key to the remote server:


 ssh-copy-id user@hostname


3. Now, you can connect without entering a password.

File Transfer with SSH

  • **SCP** – Secure copy files:


 scp file.txt user@hostname:/remote/path/


  • **SFTP** – Interactive secure file transfer:


 sftp user@hostname


SSH Configuration File

User-specific SSH options can be set in:


 ~/.ssh/config


Example:


Host seedbox

   HostName your.seedbox.com
   User yourusername
   Port 22


Now you can connect using:


 ssh seedbox


Security Tips

  • Use **SSH keys** instead of passwords
  • Disable root login (`PermitRootLogin no`) in the SSH configuration
  • Change the default port from 22 to another port
  • Use a firewall (e.g., ufw or iptables)
  • Monitor for brute-force attempts with tools like fail2ban

Related Tools

  • OpenSSH – The most common SSH implementation for Unix-like systems
  • PuTTY – A popular SSH client for Windows
  • WinSCP – GUI-based file transfer over SSH for Windows

See Also