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

推荐订阅源

T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
News | PayPal Newsroom
S
Security Affairs
T
Tor Project blog
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security @ Cisco Blogs
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Help Net Security
Help Net Security
U
Unit 42
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
Cisco Talos Blog
Cisco Talos Blog
量子位
F
Full Disclosure
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
有赞技术团队
有赞技术团队
T
Troy Hunt's Blog
P
Privacy & Cybersecurity Law Blog
Forbes - Security
Forbes - Security
人人都是产品经理
人人都是产品经理
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
腾讯CDC
AI
AI
Last Week in AI
Last Week in AI
Latest news
Latest news
Google Online Security Blog
Google Online Security Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
Martin Fowler
Martin Fowler
Blog — PlanetScale
Blog — PlanetScale
V2EX - 技术
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell

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