惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Troy Hunt's Blog
F
Fortinet All Blogs
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
The Register - Security
The Register - Security
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
V
Vulnerabilities – Threatpost
S
Securelist
S
SegmentFault 最新的问题
T
Threat Research - Cisco Blogs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy International News Feed
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
GbyAI
GbyAI
Apple Machine Learning Research
Apple Machine Learning Research
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
美团技术团队
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google Online Security Blog
Google Online Security Blog
M
MIT News - Artificial intelligence
U
Unit 42
V
V2EX
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
B
Blog
博客园 - 叶小钗
Attack and Defense Labs
Attack and Defense Labs
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Hacker News: Ask HN
Hacker News: Ask HN
博客园 - Franky
Engineering at Meta
Engineering at Meta
Schneier on Security
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
IT之家
IT之家
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
Martin Fowler
Martin Fowler
SecWiki News
SecWiki News

博客园 - sunny_2016

核聚:雷·达里奥的达成目标5步法 英语发单规则一 英语学习三 英语学习笔记二 英语学习笔记一 modbus协议 OPC UA协议学习笔记 限制ssh非法登录 linux添加hosts.deny文件 jmeter的tcp请求示例发送16进制报文 pymodbus模拟modbus slave从站(二) 使用python的pymodbus实现modbus slave 模拟从站一 secure crt使用ssh密钥登录提示未知文件格式 专业的通讯调试工具或者平台有哪些 centos7.9上面卸载中文语言包和中文字体重新安装 linux centos7.9 中文乱码 Windows 11 主机上建立反向隧道,实现服务端连接内网客户端主机 互联网上的高危IP,一直在尝试sshd破解 通过/etc/hosts.deny限制一个网段的 SSH 登录尝试 linux查询近8小时ssh登录失败的ip转换为hosts.deny格式打印 多系统集成分析——ERP与OA、PLM、MES、CRM、WMS、SRM、HR ERP也有库存管理、生产管理、流程审批,为什么还要上WMS、MES和OA? gitlab流水线执行发布提示: No such file or directory gitlab-runner注册完提示:New runner. Has not connected yet(新的Runner,尚未连接) 电池片组件生产工艺流程
linux pkill命令的坑
sunny_2016 · 2025-12-21 · via 博客园 - sunny_2016

执行pkill ssh后无法重新登录,可能是误杀了sshd服务进程(SSH服务端主进程),导致SSH服务停止,无法接受新连接。若仅需杀掉某条SSH连接(而非停止服务),需通过以下步骤操作:

一、无法重新登录的原因‌
pkill ssh命令会终止所有名称包含ssh的进程,包括:

sshd服务进程‌:SSH服务端主进程(负责监听和接受新连接)被终止后,新的SSH连接请求会被拒绝‌

二、恢复SSH服务(解决无法登录)‌
若已通过本地终端或控制台登录服务器,需重启sshd服务:

bash
systemctl restart sshd # 重启SSH服务
systemctl enable sshd # 确保开机自启(防止重启后服务未启动)‌:ml-citation{ref="3" data="citationList"}
若无法本地登录,需通过服务器物理控制台或带外管理口(如iDRAC)操作,或重启服务器后SSH服务会自动恢复(需确保sshd已设置开机自启)‌

三、杀掉某条SSH连接(不停止服务)‌
1. 查看当前SSH连接‌
先通过以下命令找到目标连接的进程ID(PID):

bash
# 方法1:查看所有SSH连接的进程信息
ps aux | grep sshd
# 输出示例:root 1234 0.0 0.1 12345 6789 ? Ss 10:00 0:00 sshd: root@pts/0

# 方法2:通过端口和IP定位(推荐)
netstat -tunlp | grep sshd
# 或(CentOS 7需安装net-tools)
ss -ntp | grep sshd
# 输出示例:tcp 0 0 192.168.1.100:22 192.168.1.200:56789 ESTABLISHED 1234/sshd: root@pts
记录目标连接的PID(如示例中的1234)和客户端IP(如192.168.1.200)。