AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-730688

drjeep's questions

Martin Hope
drjeep
Asked: 2025-04-14 23:10:21 +0800 CST

繁忙的 SFTP 服务器上的 systemd-logind 和 d-bus 问题

  • 6

我们最近将运行的大容量 CentOS 7 SFTP 服务器升级openssh/internal-sftp到 Rocky Linux 8。

然而,升级后,服务器运行1-2小时后,我们遇到了登录超时的问题。这似乎与打开的SFTP会话和/或systemd --user进程数量有关。

1-2 小时后,新的 SFTP 登录变得非常慢,我们开始在日志中看到这些消息

Apr 14 12:16:58 sftp sshd[330585]: pam_systemd(sshd:session): Failed to create session: Connection timed out

有时,如果足够多的 SFTP 会话关闭得足够快,问题就会解决,但更多时候我们必须重新启动服务器才能恢复正常服务。

是否建议禁用它systemd-logind,因为 SSH 似乎不需要它?

更新
不确定这是否相关,但systemctl list-units --state=abandoned返回了 100 个被放弃的会话。

更新 2
禁用后pam_systemd.so系统恢复正常运行。这实际上禁用了systemd-logindSSH 会话。

系统负载减少 80% 表明使用时性能会受到巨大损失systemd-logind。

这正常吗?!

linux
  • 1 个回答
  • 36 Views
Martin Hope
drjeep
Asked: 2025-04-10 19:45:12 +0800 CST

PAM maxlogins 限制不起作用

  • 6

自从从 CentOS 7 升级到 Rocky Linux 8 后,我们的 PAMmaxlogins限制不再对 SFTP 会话强制执行。

SFTP 用户属于该sftp组,我们在/etc/security/limits.d/10-maxlogins.conf

@sftp        -       maxlogins       1

我们用于internal-sftpSFTP 会话,并且/etc/ssh/sshd_config

Subsystem sftp  internal-sftp -l INFO

Match Group sftp
        ChrootDirectory %h
        ForceCommand internal-sftp
        AllowTcpForwarding no

但是,用户仍然能够同时打开 1 个以上的 SFTP 会话。我们是否应该在 EL8 中采取一些不同的措施来强制执行这些限制?

更新:
已启用 PAM 调试日志,可以看到它正在读取相关的配置文件。但是,该限制并未强制执行。

Apr 10 16:13:04 sftp-test sshd[40955]: Accepted password for sftptest from 10.3.200.146 port 60976 ssh2
Apr 10 16:13:04 sftp-test sshd[40955]: pam_limits(sshd:session): reading settings from '/etc/security/limits.conf'
Apr 10 16:13:04 sftp-test sshd[40955]: pam_limits(sshd:session): reading settings from '/etc/security/limits.d/10-max-logins.conf'
Apr 10 16:13:04 sftp-test sshd[40955]: pam_limits(sshd:session): checking if sftptest is in group sftp
Apr 10 16:13:04 sftp-test sshd[40955]: pam_limits(sshd:session): process_limit: processing - maxlogins 1 for GROUP
Apr 10 16:13:04 sftp-test sshd[40955]: pam_limits(sshd:session): checking logins for 'sftptest' (maximum of 1)
Apr 10 16:13:04 sftp-test systemd[40960]: pam_unix(systemd-user:session): session opened for user sftptest(uid=1000) by sftptest(uid=0)
Apr 10 16:13:04 sftp-test sshd[40955]: pam_unix(sshd:session): session opened for user sftptest(uid=1000) by sftptest(uid=0)
Apr 10 16:13:26 sftp-test sshd[40986]: Accepted password for sftptest from 10.3.200.146 port 52110 ssh2
Apr 10 16:13:26 sftp-test sshd[40986]: pam_limits(sshd:session): reading settings from '/etc/security/limits.conf'
Apr 10 16:13:26 sftp-test sshd[40986]: pam_limits(sshd:session): reading settings from '/etc/security/limits.d/10-max-logins.conf'
Apr 10 16:13:26 sftp-test sshd[40986]: pam_limits(sshd:session): checking if sftptest is in group sftp
Apr 10 16:13:26 sftp-test sshd[40986]: pam_limits(sshd:session): process_limit: processing - maxlogins 1 for GROUP
Apr 10 16:13:26 sftp-test sshd[40986]: pam_limits(sshd:session): checking logins for 'sftptest' (maximum of 1)
Apr 10 16:13:26 sftp-test sshd[40986]: pam_unix(sshd:session): session opened for user sftptest(uid=1000) by sftptest(uid=0)
linux
  • 1 个回答
  • 44 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve