linux – 为什么sshd(openssh)每个连接创建两个进程?

登录前:
$ps -elf | grep sshd
5 S root     26135     1  0  80   0 - 13115 ?      17:26 ?        00:00:00 /usr/sbin/sshd
0 S test     26480 21337  0  80   0 -  4154 -      18:41 pts/27   00:00:00 grep --colour=auto sshd

登录后:

$ps -elf | grep sshd
5 S root     26135     1  0  80   0 - 13115 ?      17:26 ?        00:00:00 /usr/sbin/sshd
4 S root     26577 26135  0  80   0 - 24204 ?      18:42 ?        00:00:00 sshd: test [priv] 
5 S test     26582 26577  0  80   0 - 24204 ?      18:42 ?        00:00:00 sshd: test@pts/30 
0 S test     26653 21337  0  80   0 -  4155 -      18:42 pts/27   00:00:00 grep --colour=auto sshd

这两个过程是什么?

4 S root     26577 26135  0  80   0 - 24204 ?      18:42 ?        00:00:00 sshd: test [priv] 
5 S test     26582 26577  0  80   0 - 24204 ?      18:42 ?        00:00:00 sshd: test@pts/30

谢谢,

解决方法

权限分离 – 一个保留root权限以执行只有root可以执行的操作的进程,以及另一个执行其他操作的进程.

在询问此问题时,权限分离由sshd_config中的选项控制,sshd_config手册页解释了它的用途.权限分离在version 7.5中成为强制性的,因此该选项及其文档已消失.如果存在任何此类文档,我不知道在哪里可以找到特权分离功能的规范文档.

删除前的手册页项的最后一个版本说:

UsePrivilegeSeparation
        Specifies whether sshd(8) separates privileges by creating an
        unprivileged child process to deal with incoming network traffic.
        After successful authentication,another process will be created
        that has the privilege of the authenticated user.  The goal of
        privilege separation is to prevent privilege escalation by con-
        taining any corruption within the unprivileged processes.  The
        argument must be yes,no,or sandbox.  If UsePrivilegeSeparation
        is set to sandbox then the pre-authentication unprivileged
        process is subject to additional restrictions.  The default is
        sandbox.

相关文章

文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限...
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Wi...
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Lin...
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,...
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 Open...