# ubuntu怎么启动ssh服务

为什么要启动ssh服务呢?

答:目的是可以让外部的主机远程连接进来。

# 第1步)检查是否安装了shh

ubuntu检查是否安装某软件 | 匆匆趣玩 (opens new window)

# 第2步)安装ssh相关软件

sudo apt update
1
sudo apt install openssh-server
1

# 第3步)启动SSH服务

启动服务

sudo systemctl start ssh
1

设置开机自启

sudo systemctl enable ssh
1

检查服务状态

sudo systemctl status ssh
1

最后检查防火墙

  • 查看防火墙状态

    sudo ufw status

  • 如果防火墙开启,允许 SSH 连接

    sudo ufw allow ssh

  • 或者指定端口

    sudo ufw allow 22

Last Updated: 11/30/2025, 2:55:40 PM