Ubuntu Server 26.04如何配置 SSH 并实现登录

在服务器运维与开发部署中,SSH(Secure Shell)是连接和管理远程 Linux 服务器的核心通道。针对最新发布的 Ubuntu Server 26.04 LTS,本教程将从服务端配置、网络放行、客户端连接到安全加固,提供一套详尽且可直接落地的完整指南。

一、 服务端配置:安装与启动 SSH 服务

Ubuntu Server 26.04 的最小化安装镜像可能默认未预装 SSH 服务端组件,我们需要手动完成安装并验证其运行状态。

1、检查 ssh 服务状态

systemctl status ssh

image

报错:Unit ssh.service could not be found. 意思:openssh‑server 没有安装,系统找不到 ssh 服务单元。

执行下面命令安装 SSH 服务

sudo apt update
sudo apt install openssh-server

image

安装完成后,再查看状态:

systemctl status ssh

image

显示 active (running) ✅ 已经正常运行。

启动 ssh 服务(传统方式)

sudo systemctl enable --now ssh

image

执行完再查看状态:

systemctl status ssh

image

SSH 服务已经完全正常运行! 从日志可以看到:

  • Active: active (running) 服务正在运行
  • Server listening on 0.0.0.0 port 22 监听 22 端口,IPv4/IPv6 都开启

posted on 2026-08-26 12:52  九幽提刑官  阅读(3)  评论(0)    收藏  举报

导航