- Ubuntu 24.04 LTS
Ubuntu 配置
sudo apt update
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
sudo systemctl status ssh
sudo ufw status
sudo ufw allow ssh
sudo ufw reload
sudo ufw status
安装 OpenSSH 服务器
首先,您需要安装 OpenSSH 服务器,这样才能通过 SSH 远程连接到您的 Ubuntu 系统。打开终端。更新包索引:
sudo apt update
安装 OpenSSH 服务器:
sudo apt install openssh-server
启动并启用 OpenSSH 服务
安装完成后,OpenSSH 服务默认会自动启动,但您可以手动确认并启用它,以确保它在系统启动时也会启动。
启动 OpenSSH 服务:
sudo systemctl start ssh
启用 OpenSSH 服务(确保在系统启动时自动启动):
sudo systemctl enable ssh
检查 OpenSSH 服务的状态,确保它正在运行:
sudo systemctl status ssh
如果一切正常,您将看到类似于下面的信息:
● ssh.service - OpenBSD Secure Shell server
Loaded