在 Ubuntu 桌面系统启用 ssh 服务

Linux 2021-12-13 阅读 156 评论 0

问题描述

电脑安装 Ubuntu 20.04 桌面版之后,发现局域网的电脑通过 ssh 无法登录。

$ ssh test@192.168.8.6
ssh: connect to host 192.168.8.6 port 22: Connection refused

解决方法

默认情况下,SSH 服务未安装在 Ubuntu 桌面系统上。可以通过终端,运行 apt 轻松地安装 openssh-server

sudo apt update
sudo apt install openssh-server

安装之后再次运行。

$ ssh test@192.168.8.6                                                                 
cpm@192.168.8.6's password: 
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-27-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

182 updates can be applied immediately.
107 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Mon Dec 13 21:56:52 2021 from 192.168.8.123
最后更新 2021-12-13