Quando inicio o processo sshd usando systemctl, o processo inicia com sucesso, mas é finalizado ~ 5 segundos depois. Quando executo o comando ExecStart na linha de comando, o ssh é executado sem problemas.
Alguém pode me dizer por que o systemd pode estar enviando um sigterm para o sshd quando começou a usar o systemctl?
Estou executando o SLES12-SP2.
Saída de "systemctl status sshd" logo após rodar "systemctl start sshd":
● sshd.service - OpenSSH Daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2017-07-09 12:51:10 BST; 2s ago
Process: 21727 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUCCESS)
Main PID: 21734 (sshd)
Tasks: 1 (limit: 8192)
CGroup: /system.slice/sshd.service
└─21734 /usr/sbin/sshd -D -ddd
Jul 09 12:51:10 Duke sshd[21734]: debug1: rexec_argv[2]='-ddd'
Jul 09 12:51:10 Duke sshd[21734]: debug3: oom_adjust_setup
Jul 09 12:51:10 Duke sshd[21734]: debug1: Set /proc/self/oom_score_adj from 0 to -1000
Jul 09 12:51:10 Duke sshd[21734]: debug2: fd 3 setting O_NONBLOCK
Jul 09 12:51:10 Duke sshd[21734]: debug1: Bind to port 22 on 0.0.0.0.
Jul 09 12:51:10 Duke sshd[21734]: Server listening on 0.0.0.0 port 22.
Jul 09 12:51:10 Duke sshd[21734]: debug2: fd 4 setting O_NONBLOCK
Jul 09 12:51:10 Duke sshd[21734]: debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
Jul 09 12:51:10 Duke sshd[21734]: debug1: Bind to port 22 on ::.
Jul 09 12:51:10 Duke sshd[21734]: Server listening on :: port 22.
Saída de "systemctl status sshd" apenas cerca de 5 segundos depois:
● sshd.service - OpenSSH Daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Sun 2017-07-09 12:51:12 BST; 2s ago
Process: 21734 ExecStart=/usr/sbin/sshd -D -ddd $SSHD_OPTS (code=exited, status=0/SUCCESS)
Process: 21727 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUCCESS)
Main PID: 21734 (code=exited, status=0/SUCCESS)
Jul 09 12:51:10 Duke sshd[21734]: debug2: fd 3 setting O_NONBLOCK
Jul 09 12:51:10 Duke sshd[21734]: debug1: Bind to port 22 on 0.0.0.0.
Jul 09 12:51:10 Duke sshd[21734]: Server listening on 0.0.0.0 port 22.
Jul 09 12:51:10 Duke sshd[21734]: debug2: fd 4 setting O_NONBLOCK
Jul 09 12:51:10 Duke sshd[21734]: debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
Jul 09 12:51:10 Duke sshd[21734]: debug1: Bind to port 22 on ::.
Jul 09 12:51:10 Duke sshd[21734]: Server listening on :: port 22.
Jul 09 12:51:12 Duke systemd[1]: Stopping OpenSSH Daemon...
Jul 09 12:51:12 Duke systemd[1]: Stopped OpenSSH Daemon.
Jul 09 12:51:12 Duke sshd[21734]: Received signal 15; terminating.
Conteúdo de /usr/lib/systemd/system/sshd.service:
[Unit]
Description=OpenSSH Daemon
After=network.target
[Service]
EnvironmentFile=-/etc/sysconfig/ssh
ExecStartPre=/usr/sbin/sshd-gen-keys-start
ExecStart=/usr/sbin/sshd -D -ddd $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=never
[Install]
WantedBy=multi-user.target
Nota: Eu mudei o Restart para nunca de sempre para poder ver as últimas mensagens do sshd. O SSHD é finalizado nos dois casos.