--- title: "SSH" type: concept tags: [security, networking, remote-access] date: 2026-04-16 --- ## Definition SSH(Secure Shell,安全外壳)是一种加密网络协议,用于安全地远程登录计算机系统、执行命令和传输文件。 ## Key Properties - 默认端口:22 - 加密传输(RSA、ECDSA、Ed25519 等算法) - 支持密码认证和公钥认证 - 支持端口转发、隧道功能 ## Commands ```bash ssh user@hostname # 远程登录 scp file user@host:/path # 安全复制 sftp user@host # 安全文件传输 ssh-keygen -t ed25519 # 生成密钥 ``` ## Security Best Practices - 禁用密码认证,使用密钥登录 - 更改默认端口 - 使用防火墙限制访问来源 - 启用 Fail2Ban 防止暴力破解 - 定期更新 SSH 版本 ## Connections - [[OpenSSH]] ← implements ← [[SSH]] - [[UFW]] ← controls_access ← [[SSH]]