[3rd-Party Apps] Deepin 20.8 sshd 启动后无法获得客户端的登录
Tofloor
poster avatar
JacksonWu
deepin
2023-01-14 02:50
Author

我在Deepin 20.8 上遇到了从别的电脑无法ssh登录的问题。

sudo apt install openssh-server

sudo service ssh start

sudo ufw allow 22

sudo lsof -i :22
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 7265 root 3u IPv4 116431 0t0 TCP *:ssh (LISTEN)
sshd 7265 root 4u IPv6 116433 0t0 TCP *:ssh (LISTEN)

/var/log/syslog中有如下的打印

2023-01-13 18:19:21 zwu-PC kernel: [ 2672.579853] audit: type=1326 audit(1673605161.424:40): auid=4294967295 uid=110 gid=65534 ses=4294967295 subj=unconfined pid=6697 comm="sshd" exe="/usr/sbin/sshd" sig=31 arch=c000003e syscall=230 compat=0 ip=0x7efff0d4230e code=0x0

/var/log/auth.log 中并没有任何打印。

客户端的登录命令和结果是:

ssh -p 22 zwu@192.168.0.157

Connection closed by 192.168.0.157 port 22

Reply Favorite View the author
All Replies
deepinuser17
deepin
2023-01-14 07:43
#1

从另一台机器上ping Deepin 20.8 机器。

ping 192.168.0.157

如果ping没有正常的回馈,说明网络连接有问题。 这是auth.log没有登录连接尝试的原因。

如果可以正常ping, 查看/home/zwu 和 /home/zwu/.ssh 的权限。 /home/zwu不能有所有用户读写的权限。 /home/zwu/.ssh 只能有该用户的读写权限。 所有/home/zwu/.ssh内的文件, 该用户必须有读写的权限,尤其是 known_hosts

ls -ld /home/zwu

ls -ld /home/zwu/.ssh

Reply View the author
JacksonWu
deepin
2023-01-16 19:02
#2

谢谢您的回复。

(1) 从另一台机器ping 这台机器是正常的。

(2)看home及ssh目录的权限好像也没有问题

zwu@zwu-PC:$ ls -ld /home/zwu
drwxr-x--- 25 zwu zwu 4096 1月 16 10:37 /home/zwu
zwu@zwu-PC:$ ls -ld /home/zwu/.ssh/
drwx------ 2 zwu zwu 4096 1月 13 15:57 /home/zwu/.ssh/
zwu@zwu-PC:~$ ls -ld /home/zwu/.ssh/*
-r-------- 1 zwu zwu 1811 1月 13 15:57 /home/zwu/.ssh/id_rsa
-rw-r--r-- 1 zwu zwu 392 1月 13 15:57 /home/zwu/.ssh/id_rsa.pub
-rw-r--r-- 1 zwu zwu 444 1月 13 15:54 /home/zwu/.ssh/known_hosts

/var/log/syslog中有如下的打印

2023-01-13 18:19:21 zwu-PC kernel: [ 2672.579853] audit: type=1326 audit(1673605161.424:40): auid=4294967295 uid=110 gid=65534 ses=4294967295 subj=unconfined pid=6697 comm="sshd" exe="/usr/sbin/sshd" sig=31 arch=c000003e syscall=230 compat=0 ip=0x7efff0d4230e code=0x0

这个打印是什么意思呢?

Reply View the author
JacksonWu
deepin
2023-01-16 23:21
#3

本机器上执行 ssh -v localhost 后的打印如下:
OpenSSH_7.9p1 Deepin-deepin1 UOS_Desktop_104*, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /home/zwu/.ssh/id_rsa type 0
debug1: identity file /home/zwu/.ssh/id_rsa-cert type -1
debug1: identity file /home/zwu/.ssh/id_dsa type -1
debug1: identity file /home/zwu/.ssh/id_dsa-cert type -1
debug1: identity file /home/zwu/.ssh/id_ecdsa type 2
debug1: identity file /home/zwu/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/zwu/.ssh/id_ed25519 type -1
debug1: identity file /home/zwu/.ssh/id_ed25519-cert type -1
debug1: identity file /home/zwu/.ssh/id_xmss type -1
debug1: identity file /home/zwu/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Deepin-deepin1 UOS_Desktop_104*
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Deepin-deepin1 UOS_Desktop_104*
debug1: match: OpenSSH_7.9p1 Deepin-deepin1 UOS_Desktop_104* pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'zwu'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:arIKUjGc0+HUHkb1cmKTv7wuhT7SvmfwGrJtztqLUs4
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256:arIKUjGc0+HUHkb1cmKTv7wuhT7SvmfwGrJtztqLUs4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/zwu/.ssh/id_ecdsa ECDSA SHA256:mFTRC9zXa75vzsGORhjNUVvO5tBkIeAHR/+Duzi7w5I agent
debug1: Will attempt key: /home/zwu/.ssh/id_rsa RSA SHA256:inRKAyAOMI6IEkC83oFJGdnx6DQM7Mh3ZUMi2/xm6uc agent
debug1: Will attempt key: /home/zwu/.ssh/id_dsa
debug1: Will attempt key: /home/zwu/.ssh/id_ed25519
debug1: Will attempt key: /home/zwu/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=
debug1: SSH2_MSG_SERVICE_ACCEPT received
Connection closed by ::1 port 22

Reply View the author
JacksonWu
deepin
2023-01-17 00:28
#4

下载了最新的OpenSSH 版本,openssh-9.1p1.tar.gz

https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz

编译安装后,已经正常了,怀疑是OpenSSH_7.9p1 和Deepin 20.8 的底层库和内核不匹配。

Reply View the author