麒麟桌面操作系统V10无法通过ssh连接

1.确保SSH服务已安装并启用

首先确保目标主机上已经安装了 SSH 服务,并且服务正在运行。你可以通过以下命令检查 SSH 服务的状态。

1.检查 SSH 服务状态:

root@test-pc:~# systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2025-02-28 11:33:30 CST; 2min 28s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 9051 (sshd)
      Tasks: 1 (limit: 19066)
     Memory: 1.5M
     CGroup: /system.slice/ssh.service
             └─9051 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

228 11:33:30 test-pc systemd[1]: Starting OpenBSD Secure Shell server...
228 11:33:30 test-pc sshd[9051]: Server listening on 0.0.0.0 port 22.
228 11:33:30 test-pc sshd[9051]: Server listening on :: port 22.
228 11:33:30 test-pc systemd[1]: Started OpenBSD Secure Shell server.
root@test-pc:~# 

如果SSH服务未安装或未运行,可以尝试以下步骤来启动和启用SSH服务。

2.安装SSH服务:

sudo apt install openssh-server

3.启动SSH服务:

root@test-pc:~# systemctl start ssh
root@test-pc:~# systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2025-02-28 11:33:30 CST; 2min 28s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 9051 (sshd)
      Tasks: 1 (limit: 19066)
     Memory: 1.5M
     CGroup: /system.slice/ssh.service
             └─9051 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

228 11:33:30 test-pc systemd[1]: Starting OpenBSD Secure Shell server...
228 11:33:30 test-pc sshd[9051]: Server listening on 0.0.0.0 port 22.
228 11:33:30 test-pc sshd[9051]: Server listening on :: port 22.
228 11:33:30 test-pc systemd[1]: Started OpenBSD Secure Shell server.
root@test-pc:~# 

4.设置SSH服务开机自启:

root@test-pc:~# systemctl enable ssh
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
root@test-pc:~# 

5.SSH配置文件检查

通常位于/etc/ssh/sshd_config。检查PermitRootLogin和PasswordAuthentication等配置

test@test-pc:/root$ sudo vi /etc/ssh/sshd_config

把PermitRootLogin和PasswordAuthentication修改成yes或者是前面有#去掉#
在这里插入图片描述

6.重启系统

sudo reboot