- Encryption:
- All data transmitted between the client and server is encrypted, ensuring that sensitive information, such as passwords, cannot be intercepted.
- Authentication:
- SSH supports multiple authentication methods:
- Password-based authentication: Requires a username and password.
- Public-key authentication: Uses cryptographic keys for stronger security.
- Port Forwarding:
- Allows you to securely forward ports for accessing services on a remote server through an encrypted tunnel.
- File Transfer:
- SSH can be used to transfer files securely using protocols like SCP (Secure Copy Protocol) or SFTP (SSH File Transfer Protocol).
- Remote Command Execution:
- Execute commands on a remote server without physically accessing it.
- Tunneling:
- Create encrypted tunnels for secure communication, useful for bypassing firewalls or securing otherwise insecure protocols.
- How SSH Works:
- Connection Initiation:
- The client starts the connection to the SSH server (usually running on port 22 by default).
- Handshake:
- A cryptographic handshake is performed to establish a secure connection. This involves:
- Exchanging cryptographic keys.
- Verifying the server’s authenticity using its public key.
- Authentication:
- The client authenticates itself using a username and password or a private key.
- Secure Session:
- Once authenticated, the client and server establish a secure session for communication.
- SSH Tools and Commands:
- SSH Client:
- Software used to initiate an SSH connection. Examples include:
- OpenSSH: Commonly used on Linux and macOS.
- PuTTY: A popular SSH client for Windows.
- MobaXterm: A feature-rich client for Windows.
- Common SSH Commands:
- Login to a remote server:
bash Copy code ssh username@hostname
- Copy files to a remote server:
scp localfile username@hostname:/path/to/destination
- Copy files from a remote server:
scp username@hostname:/path/to/source localfile
- Tunneling:
- ssh -L local_port:remote_host:remote_port username@hostname
- Use Cases of SSH:
- Remote Administration:
- Manage servers and devices remotely over a secure connection.
- Secure File Transfer:
- Transfer files between local and remote systems securely using SCP or SFTP.
- Automated Scripts:
- Use SSH in scripts to automate tasks on remote servers.
- Tunneling and Port Forwarding:
- Securely access internal network resources from outside.
- Version Control Systems:
- Tools like Git use SSH for secure communication with remote repositories.