Expanded SSH Lecture
Expanded SSH Lecture
Lecture Overview
What SSH Provides
• Encryption: Ensures all communication is secure from unauthorized access.
• Authentication: Supports both passwords and key pair login methods.
• Secure Networking: Protects data over insecure or public networks.
Common SSH Uses
• Remote login to servers from anywhere securely.
• Execute remote commands as if on the local machine.
• Secure file transfers using scp or sftp.
• Manage routers, switches, and other devices securely.
• Automate system tasks using key-based authentication.
• Create secure tunnels to protect other protocols.
How SSH Works
• Based on a client-server model over TCP port 22.
• Client saves server's public key upon first connection.
• Supports multiple authentication methods:
- Username + Password
- Public/Private Key
- SSH Agent for key management (SSO)
SSH vs Other Protocols
• SSH vs Telnet: SSH is encrypted; Telnet sends data in plaintext.
• SSH vs TLS/SSL: SSH encrypts and authenticates both ends;
TLS usually authenticates the server only.
SSH Tunneling (Port Forwarding)
• Local Forwarding: Redirect local port to remote service.
• Remote Forwarding: Make local service accessible remotely.
• Dynamic Forwarding: Acts as secure SOCKS proxy for internet access.
SSH Security Practices
• Key management: Generate, rotate, and revoke keys securely.
• Never hardcode credentials in code or scripts.
• Review and clean known_hosts regularly.
• Use SSH2 (modern and secure); avoid SSH1 due to vulnerabilities.
SSH Tools and Commands
• ssh: Start an SSH session (e.g., ssh user@host)
• sshd: The SSH server daemon.
• scp / sftp: Tools for secure file transfer.
• ssh-keygen: Generates key pairs.
• ssh-agent + ssh-add: Manage and use keys securely.
• ssh-copy-id: Adds your public key to a remote host.
History of SSH
• Created in 1995 by Tatu Ylönen.
• Replaced insecure tools like Telnet, rlogin, rsh.
• SSH2 introduced in 2006 with better security and features.