I
I
Igor Tkhorik2016-09-05 20:00:11
SSH
Igor Tkhorik, 2016-09-05 20:00:11

The ssh service does not restart, what is the reason?

Good afternoon, I sat down to study ubuntu administration and ran into the following problem:
When setting up SFTP (I set up ssh and sftp according to the manual), at the step of restarting SSH, I encountered the problem Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details. . Here is the entry from the "journalctl -xe" log .
Has anyone encountered such a problem? Thank you very much in advance.

Sep 05 18:06:11 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Failed with result 'exit-code'.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Reloading.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: apt-daily.timer: Adding 9h 28min 21.099122s random time.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Reloading.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: apt-daily.timer: Adding 6h 55min 6.176419s random time.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has finished shutting down.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
- - Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has begun starting up.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal sshd[12464]: /etc/ssh/sshd_config line 96: Directive 'UsePAM' is not allowed within a Match block
Sep 05 18:06:13 Ubuntu- 1604-xenial-64-minimal systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1 ]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has failed.
--
-- The result is failed.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Unit entered failed state.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Failed with result 'exit-code'.
Sep 05 18:06:16 Ubuntu-1604-xenial-64-minimal sudo[11661]: pam_unix(sudo:session): session closed for user root
Sep 05 18:06:47 Ubuntu-1604-xenial-64-minimal sudo [12475]: root : TTY=pts/2 ; PWD=/root ; USER=root ; COMMAND=/bin/nano /etc/ssh/sshd_config
Sep 05 18:06:47 Ubuntu-1604-xenial-64-minimal sudo[12475]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 05 18:08:07 Ubuntu-1604 -xenial-64-minimal sudo[12475]: pam_unix(sudo:session): session closed for user root
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal sudo[12477]: root : TTY=pts/ 2; PWD=/root ; USER=root ; COMMAND=/usr/sbin/service ssh restart
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal sudo[12477]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support:lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has finished shutting down.
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
- - Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has begun starting up.
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal sshd[12484]: /etc/ssh/sshd_config line 101: Directive 'UsePAM' is not allowed within a Match block
Sep 05 18:08:10 Ubuntu- 1604-xenial-64-minimal systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal sudo[12477]: pam_unix(sudo:session): session closed for user root
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal systemd [1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has failed.
--
-- The result is failed.
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Unit entered failed state.
Sep 05 18:08:10 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Failed with result 'exit-code'.
Sep 05 18:17:01 Ubuntu-1604-xenial-64-minimal CRON[12492]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 05 18:17:01 Ubuntu-1604- xenial-64-minimal CRON[12493]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Sep 05 18:17:01 Ubuntu-1604-xenial-64-minimal CRON[12492 ]: pam_unix(cron:session): session closed for user root
Sep 05 18:25:40 Ubuntu-1604-xenial-64-minimal sudo[12497]: root : TTY=pts/2 ; PWD=/root ; USER=root ; COMMAND=/usr/sbin/service ssh restart
Sep 05 18:25:40 Ubuntu-1604-xenial-64-minimal sudo[12497]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 05 18:25:40 Ubuntu-1604-xenial-64-minimal systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has finished shutting down.
Sep 05 18:25:40 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
- - Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has begun starting up.
Sep 05 18:25:41 Ubuntu-1604-xenial-64-minimal sshd[12504]: /etc/ssh/sshd_config line 101: Directive 'UsePAM' is not allowed within a Match block
Sep 05 18:25:41 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Sep 05 18:25:41 Ubuntu-1604 -xenial-64-minimal sudo[12497]: pam_unix(sudo:session): session closed for user root
Sep 05 18:25:41 Ubuntu-1604-xenial-64-minimal systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has failed.
--
-- The result is failed.
Sep 05 18:25:41 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Unit entered failed state.
Sep 05 18:25:41 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Failed with result 'exit-code'.
lines 1364-1453/1453 (END)
Sep 05 18:06:11 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Failed with result 'exit-code'.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Reloading.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: apt-daily.timer: Adding 9h 28min 21.099122s random time.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Reloading.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: apt-daily.timer: Adding 6h 55min 6.176419s random time.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has finished shutting down.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
- - Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has begun starting up.
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal sshd[12464]: /etc/ssh/sshd_config line 96: Directive 'UsePAM' is not allowed within a Match block
Sep 05 18:06:13 Ubuntu-1604-xenial-64-minimal systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Sep 05 18:06:13 Ubuntu-1604 -xenial-64-minimal systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ssh.service has failed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2016-09-05
@leahch

Well, it also writes to you that there are problems in the config
The UsePAM directive is in the wrong place, the error is on line 96 .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question