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

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
V
Visual Studio Blog
S
Securelist
P
Palo Alto Networks Blog
A
Arctic Wolf
T
Tor Project blog
P
Proofpoint News Feed
I
InfoQ
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
G
GRAHAM CLULEY
M
MIT News - Artificial intelligence
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Apple Machine Learning Research
Apple Machine Learning Research
S
Secure Thoughts
Cyberwarzone
Cyberwarzone
Blog — PlanetScale
Blog — PlanetScale
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
腾讯CDC
Latest news
Latest news
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
S
SegmentFault 最新的问题
Schneier on Security
Schneier on Security
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LINUX DO - 热门话题
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
C
Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
The Last Watchdog
The Last Watchdog
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Know Your Adversary
Know Your Adversary
U
Unit 42

博客园 - 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)。