找回密码
 注册
查看: 397|回复: 2

升级openssh 之后scp: Connection closed 问题记录过程

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-8-25 10:38:00 | 显示全部楼层 |阅读模式
scp: Connection closed问题记录过程5 @/ d5 c, ?) F# ^: V( p9 D% w
1 |4 @% t; |& `" v) e; e" p0 t, S
再传输文件时,提示错误。这个问题挺奇怪的。
- w$ t9 |+ W7 q  v+ {' t日志也没有。
9 z0 j  c: c) `# h, i8 V. |0 [修改/etc/hosts.allow文件& u5 M" Z( n) H( z6 m
sshd:ALL* J! V9 C; I( w. d4 l
重启sshd服务,问题依旧。" W& O* r  ^- \8 S5 _$ Q

! E8 O8 P, J$ e' k) m: @" g: N5 a4 ^0 h( ], B% ]

- G& X* Y7 D; Q% v! W) IAug 25 10:36:01server_02 systemd: Started Session 171182 of user root.
' v9 n" ]3 e8 K, SAug 25 10:36:18 server_02 systemd: Started Session 171183 of user devops.. D/ d; ~5 x2 h! k' P+ C6 N! F3 s
Aug 25 10:36:18 server_02 systemd-logind: New session 171183 of user devops.
! u- C+ \: E1 t8 oAug 25 10:36:18 server_02 systemd-logind: Removed session 171183.+ c. ]' I2 `+ l: I4 }5 F
2 t6 t- X9 n) s+ `# x
0 `9 n- e" v) g2 Z! O
0 R8 w4 I3 C( `& D/ [+ _+ w
Aug 25 10:36:50 server_02 systemd-logind: New session 171184 of user devops.
9 q2 J1 D/ @. v, ~- VAug 25 10:36:50 server_02 systemd: Started Session 171184 of user devops.9 U6 J4 c! Y. i
Aug 25 10:36:50 server_02 systemd-logind: Removed session 171184.
6 L+ r& G, M  i易陆发现bbs168x2 p/ B! D* _, L$ I: f  D
0 e. M; X7 G9 Q* S  k# M  n# u

8 p. t! z6 V3 E; h! {  K1 M
$ y) P5 H1 U- Y: P) Y  J
7 z4 Z3 S; h$ j% T

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-8-25 10:42:48 | 显示全部楼层
再看secure日志:
1 J- T; w; \" F' tAug 25 10:40:00 server_02 sshd[37895]: Accepted password for devo  from 12.4.21.6 port 56366 ssh21 f  }: \) L& m/ F
Aug 25 10:40:00 server_02 sshd[37895]: pam_unix(sshd:session): session opened for user devo by (uid=0)5 ]5 P* I& e& W( ^) y
Aug 25 10:40:00 server_02 sshd[38316]: Received disconnect from 12.4.21.6 port 56366:11: disconnected by user
- j0 P, {) y, K! Z' T1 k) |$ DAug 25 10:40:00 server_02 sshd[38316]: Disconnected from user devo 12.4.21.6 port 56366
6 c: u: `! `2 `' R5 Q1 |Aug 25 10:40:00 server_02 sshd[37895]: pam_unix(sshd:session): session closed for user devo

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-8-25 14:03:39 | 显示全部楼层
最后能解决办法的是,通过重新安装openssh-server安装包。再次编译的时候,不添加--sysconfig=/etc/ssh   这个参数即可。
2 ]8 G: ]8 N5 C" n* v# Q# u" Y' i, N9 l
./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl/
4 i# H, a) `) \& c保持这样即可。
9 ?* d. \/ t/ P' S5 l3 y( S不再执行rpm -e openssh-server这个操作' Z' j* q. o0 n; E

, L( h. P& ?8 }' u! v0 n# x$ S- e7 O
后面操作这样即可;
( }" z1 U& N7 l* s& f- p#copy file
4 f: V! @* C% }$ O/ y\cp -fp  /etc/ssh-bak/sshd_config /usr/local/openssh/etc/sshd_config9 R# x" G: o: Z& n  c% G
ln -sf /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config+ s& j/ l6 m& C9 ~& h# m" o9 K
#\cp -pf /etc/pam.d/sshd-bak /etc/pam.d/sshd  h# Q9 |6 l1 f0 u$ b' l6 {
mv /usr/sbin/sshd /usr/sbin/sshd-bak6 o9 U& Q& l5 {: W$ g, H1 M
mv /usr/bin/sshd /usr/bin/sshd-bak
1 g% P! G' w. L$ C2 q4 A$ [#cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd" L& d- @8 U2 X1 b
mv  /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak
3 K: Q0 s5 e1 e9 f# U# ?7 Gcp /usr/local/openssh/bin/sshd /usr/bin/sshd0 n+ X: S$ f! Z7 P9 v
cp /usr/local/openssh/bin/sshd /usr/sbin/sshd0 A- J/ x/ S$ f7 a8 e: A
mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak; c  ?1 {8 p0 {; K
cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub7 ~$ X+ _' p- f2 n1 o1 t/ B9 y

, e4 l0 {! Q9 W+ _/ L
! t6 B$ d4 l' L- d+ l5 @, L问题解决。scp即可正常使用。 来自易陆发现bbs168x
6 B% @; @# I1 e) s4 U/ S. i
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:45 , Processed in 0.015682 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表