Sshd starts two processes, but systemd stops only oneNetstat shows two sshd's listening, but only one pidCygwin sshd service starts but only produces errorsWhy does sshd(openssh) create two processes per connection?Suddenly mysql/mariadb won't startEnabling WiredTiger engine in MongoDB 3I can no longer SSH to a VM on GCP after breaking ssh configurationexecstop mysql error on stop and restartRHEL 7 service kicks in immediatelyConfiguring MySQL to Listen for Remote Connections on UbuntuDisabling systemd messages that interfere with running BASH script
Why did this prime-sequence puzzle not work?
What are the problems in teaching guitar via Skype?
Is CD audio quality good enough for the final delivery of music?
Is my router's IP address really public?
How to capture more stars?
What is the 中 in ダウンロード中?
How to make and automatically have left and right
1960s sci-fi novella with a character who is treated as invisible by being ignored
Can a Beholder use rays in melee range?
Different PCB color ( is it different material? )
Plot exactly N bounce of a ball
Why does the 6502 have the BIT instruction?
What is the most important source of natural gas? coal, oil or other?
Could I be denied entry into Ireland due to medical and police situations during a previous UK visit?
Why colon to denote that a value belongs to a type?
How is character development a major role in the plot of a story
Draw a checker pattern with a black X in the center
Windows 10 Programs start without visual Interface
Ticket sales for Queen at the Live Aid
Do you play the upbeat when beginning to play a series of notes, and then after?
Is there any use case for the bottom type as a function parameter type?
What's the connection between "kicking a pigeon" and "how a bill becomes a law"?
Smart people send dumb people to a new planet on a space craft that crashes into a body of water
Is it possible to change original filename of an exe?
Sshd starts two processes, but systemd stops only one
Netstat shows two sshd's listening, but only one pidCygwin sshd service starts but only produces errorsWhy does sshd(openssh) create two processes per connection?Suddenly mysql/mariadb won't startEnabling WiredTiger engine in MongoDB 3I can no longer SSH to a VM on GCP after breaking ssh configurationexecstop mysql error on stop and restartRHEL 7 service kicks in immediatelyConfiguring MySQL to Listen for Remote Connections on UbuntuDisabling systemd messages that interfere with running BASH script
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
There is on the linux mint 18.3 sshd (7.2p2) starts with two processes. But when I run service ssh stop
only child process stops and parent process is still run. So when I restart ssh service it can't bind 22 port and became unable to receive connections.
I read about privilege separation and I think it's good despite other linuxes (for example Ubuntu) creates only one process. But why does parent process not stop when child process is stopped? And how to make systemd stop both processes?
ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
multi-user.target
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Multi-User System
Documentation=man:systemd.special(7)
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
service ssh status
service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Чт 2019-05-16 16:53:10 MSK; 6 days ago
Process: 4535 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 4538 (sshd)
Tasks: 2
Memory: 16.4M
CPU: 3.143s
CGroup: /system.slice/ssh.service
├─4538 /usr/sbin/sshd -D
└─4539 /usr/sbin/sshd -D
linux ssh
add a comment |
There is on the linux mint 18.3 sshd (7.2p2) starts with two processes. But when I run service ssh stop
only child process stops and parent process is still run. So when I restart ssh service it can't bind 22 port and became unable to receive connections.
I read about privilege separation and I think it's good despite other linuxes (for example Ubuntu) creates only one process. But why does parent process not stop when child process is stopped? And how to make systemd stop both processes?
ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
multi-user.target
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Multi-User System
Documentation=man:systemd.special(7)
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
service ssh status
service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Чт 2019-05-16 16:53:10 MSK; 6 days ago
Process: 4535 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 4538 (sshd)
Tasks: 2
Memory: 16.4M
CPU: 3.143s
CGroup: /system.slice/ssh.service
├─4538 /usr/sbin/sshd -D
└─4539 /usr/sbin/sshd -D
linux ssh
can you post ssh process with sshd systemd target file?
– asktyagi
May 21 at 4:16
@asktyagi, I added it to question
– abr_stackoverflow
May 22 at 15:33
[Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s
Can you please try to replace your service section with above lines and restart service? take backup of your file first.
– asktyagi
May 22 at 16:38
Unfortunately your advice didn't help. There was error on the strtup. I found simplier resolution. I write it to the answer.
– abr_stackoverflow
May 23 at 15:56
add a comment |
There is on the linux mint 18.3 sshd (7.2p2) starts with two processes. But when I run service ssh stop
only child process stops and parent process is still run. So when I restart ssh service it can't bind 22 port and became unable to receive connections.
I read about privilege separation and I think it's good despite other linuxes (for example Ubuntu) creates only one process. But why does parent process not stop when child process is stopped? And how to make systemd stop both processes?
ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
multi-user.target
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Multi-User System
Documentation=man:systemd.special(7)
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
service ssh status
service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Чт 2019-05-16 16:53:10 MSK; 6 days ago
Process: 4535 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 4538 (sshd)
Tasks: 2
Memory: 16.4M
CPU: 3.143s
CGroup: /system.slice/ssh.service
├─4538 /usr/sbin/sshd -D
└─4539 /usr/sbin/sshd -D
linux ssh
There is on the linux mint 18.3 sshd (7.2p2) starts with two processes. But when I run service ssh stop
only child process stops and parent process is still run. So when I restart ssh service it can't bind 22 port and became unable to receive connections.
I read about privilege separation and I think it's good despite other linuxes (for example Ubuntu) creates only one process. But why does parent process not stop when child process is stopped? And how to make systemd stop both processes?
ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service
multi-user.target
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Multi-User System
Documentation=man:systemd.special(7)
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
service ssh status
service ssh status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Чт 2019-05-16 16:53:10 MSK; 6 days ago
Process: 4535 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 4538 (sshd)
Tasks: 2
Memory: 16.4M
CPU: 3.143s
CGroup: /system.slice/ssh.service
├─4538 /usr/sbin/sshd -D
└─4539 /usr/sbin/sshd -D
linux ssh
linux ssh
edited May 22 at 15:33
abr_stackoverflow
asked May 15 at 7:34
abr_stackoverflowabr_stackoverflow
160111
160111
can you post ssh process with sshd systemd target file?
– asktyagi
May 21 at 4:16
@asktyagi, I added it to question
– abr_stackoverflow
May 22 at 15:33
[Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s
Can you please try to replace your service section with above lines and restart service? take backup of your file first.
– asktyagi
May 22 at 16:38
Unfortunately your advice didn't help. There was error on the strtup. I found simplier resolution. I write it to the answer.
– abr_stackoverflow
May 23 at 15:56
add a comment |
can you post ssh process with sshd systemd target file?
– asktyagi
May 21 at 4:16
@asktyagi, I added it to question
– abr_stackoverflow
May 22 at 15:33
[Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s
Can you please try to replace your service section with above lines and restart service? take backup of your file first.
– asktyagi
May 22 at 16:38
Unfortunately your advice didn't help. There was error on the strtup. I found simplier resolution. I write it to the answer.
– abr_stackoverflow
May 23 at 15:56
can you post ssh process with sshd systemd target file?
– asktyagi
May 21 at 4:16
can you post ssh process with sshd systemd target file?
– asktyagi
May 21 at 4:16
@asktyagi, I added it to question
– abr_stackoverflow
May 22 at 15:33
@asktyagi, I added it to question
– abr_stackoverflow
May 22 at 15:33
[Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s
Can you please try to replace your service section with above lines and restart service? take backup of your file first.– asktyagi
May 22 at 16:38
[Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s
Can you please try to replace your service section with above lines and restart service? take backup of your file first.– asktyagi
May 22 at 16:38
Unfortunately your advice didn't help. There was error on the strtup. I found simplier resolution. I write it to the answer.
– abr_stackoverflow
May 23 at 15:56
Unfortunately your advice didn't help. There was error on the strtup. I found simplier resolution. I write it to the answer.
– abr_stackoverflow
May 23 at 15:56
add a comment |
1 Answer
1
active
oldest
votes
Systemd option "KillMode" has option "mixed":
If set to mixed, the SIGTERM signal (see below) is sent to the main process while the subsequent SIGKILL signal (see below) is sent to all remaining processes of the unit's control group
Besides "KillMode" has another option "control-group"
If set to control-group, all remaining processes in the control group of this unit will be killed on unit stop (for services: after the stop command is executed, as configured with ExecStop=)
So I just find which of them use oftener in all service files, it's "mixed" and I just replace "KillMode=process" to "KillMode=mixed".
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f967325%2fsshd-starts-two-processes-but-systemd-stops-only-one%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Systemd option "KillMode" has option "mixed":
If set to mixed, the SIGTERM signal (see below) is sent to the main process while the subsequent SIGKILL signal (see below) is sent to all remaining processes of the unit's control group
Besides "KillMode" has another option "control-group"
If set to control-group, all remaining processes in the control group of this unit will be killed on unit stop (for services: after the stop command is executed, as configured with ExecStop=)
So I just find which of them use oftener in all service files, it's "mixed" and I just replace "KillMode=process" to "KillMode=mixed".
add a comment |
Systemd option "KillMode" has option "mixed":
If set to mixed, the SIGTERM signal (see below) is sent to the main process while the subsequent SIGKILL signal (see below) is sent to all remaining processes of the unit's control group
Besides "KillMode" has another option "control-group"
If set to control-group, all remaining processes in the control group of this unit will be killed on unit stop (for services: after the stop command is executed, as configured with ExecStop=)
So I just find which of them use oftener in all service files, it's "mixed" and I just replace "KillMode=process" to "KillMode=mixed".
add a comment |
Systemd option "KillMode" has option "mixed":
If set to mixed, the SIGTERM signal (see below) is sent to the main process while the subsequent SIGKILL signal (see below) is sent to all remaining processes of the unit's control group
Besides "KillMode" has another option "control-group"
If set to control-group, all remaining processes in the control group of this unit will be killed on unit stop (for services: after the stop command is executed, as configured with ExecStop=)
So I just find which of them use oftener in all service files, it's "mixed" and I just replace "KillMode=process" to "KillMode=mixed".
Systemd option "KillMode" has option "mixed":
If set to mixed, the SIGTERM signal (see below) is sent to the main process while the subsequent SIGKILL signal (see below) is sent to all remaining processes of the unit's control group
Besides "KillMode" has another option "control-group"
If set to control-group, all remaining processes in the control group of this unit will be killed on unit stop (for services: after the stop command is executed, as configured with ExecStop=)
So I just find which of them use oftener in all service files, it's "mixed" and I just replace "KillMode=process" to "KillMode=mixed".
answered May 23 at 15:59
abr_stackoverflowabr_stackoverflow
160111
160111
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f967325%2fsshd-starts-two-processes-but-systemd-stops-only-one%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
can you post ssh process with sshd systemd target file?
– asktyagi
May 21 at 4:16
@asktyagi, I added it to question
– abr_stackoverflow
May 22 at 15:33
[Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s
Can you please try to replace your service section with above lines and restart service? take backup of your file first.– asktyagi
May 22 at 16:38
Unfortunately your advice didn't help. There was error on the strtup. I found simplier resolution. I write it to the answer.
– abr_stackoverflow
May 23 at 15:56