--- title: "Ubuntu 24.04 启动 SSH 服务" type: source tags: [ssh, ubuntu, linux] date: 2026-04-16 --- ## Source File - [[raw/Home Office/Ubuntu 24.04 enable SSH.md]] ## Summary - 核心主题:在 Ubuntu 24.04 中启用 SSH 远程登录服务 - 问题域:Linux 系统管理、网络服务配置 - 方法/机制:安装 openssh-server、配置 systemctl、设置 UFW 防火墙规则 - 结论/价值:实现安全的远程 Linux 系统管理访问 ## Key Claims - Ubuntu 24.04 默认使用 ssh.socket 激活机制(按需启动),而非传统开机自启模式 - 通过 `systemctl enable ssh` 可设置 SSH 开机自启 - 修改自定义端口推荐使用 `systemctl edit ssh.socket` 而非直接修改配置文件 ## Key Quotes > "如果你发现 `systemctl status ssh` 显示服务未运行,别担心。24.04 默认使用 Socket 激活模式。" — 文档说明 socket 激活是正常行为 > "你可以通过 `sudo systemctl disable --now ssh.socket` 和 `sudo systemctl enable --now ssh.service` 切换回传统模式。" — 文档提供回退方案 ## Key Concepts - [[Socket Activation]]:按需启动服务的 systemd 机制,有连接进入时才启动守护进程 - [[SSH]]:安全远程登录协议 - [[UFW]]:Ubuntu 默认防火墙工具 ## Key Entities - [[OpenSSH]]:开源 SSH 协议实现 - [[Ubuntu]]:基于 Debian 的 Linux 发行版 - [[systemd]]:Linux 系统和服务管理器 ## Connections - [[OpenSSH]] ← depends_on ← [[systemd]] - [[Ubuntu]] ← hosts ← [[OpenSSH]] - [[UFW]] ← protects ← [[SSH]] ## Contradictions - (无)