Failed to start ssh.service: Unit ssh.service not found.

Reference: http://blog.csdn.net/mengjiangtao/article/details/24195523

sudo service ssh start

Error:

Failed to start ssh.service: Unit ssh.service not found.

add ssh.service

sudo systemctl enable ssh.service

Error:

ssh.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable ssh
insserv: warning: script 'ssh' missing LSB tags and overrides
update-rc.d: error: ssh Default-Start contains no runlevels, aborting.

Reason: /etc/init.d/ssh has no LSB tags. Refer to other documents in the following format:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $portmap
# Should-Stop:       $portmap
# X-Start-Before:    nis 
# X-Stop-After:      nis 
# Default-Start:     2 3 4 5 
# Default-Stop:      0 1 6 
# X-Interactive:     true
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

do it again:

sudo systemctl enable ssh.service
ssh.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable ssh
sudo systemctl start ssh.service
sudo systemctl status ssh.service
● ssh.service - LSB: sshd start/stop
   Loaded: loaded (/etc/init.d/ssh; bad; vendor preset: enabled)
   Active: active (running) since 二 2018-03-20 11:06:41 CST; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8576 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)
    Tasks: 1
   Memory: 2.4M
      CPU: 37ms
   CGroup: /system.slice/ssh.service
           └─8598 /usr/local/openssh-7.6p1/sbin/sshd

3月 20 11:06:41 gg systemd[1]: Starting LSB: sshd start/stop...
3月 20 11:06:41 gg ssh[8576]: unknown key type rsa1
3月 20 11:06:41 gg ssh[8576]: starting /usr/local/openssh-7.6p1/sbin/sshd... done.
3月 20 11:06:41 gg systemd[1]: Started LSB: sshd start/stop.
3月 20 11:06:41 gg sshd[8598]: Server listening on 0.0.0.0 port 22.
3月 20 11:06:41 gg sshd[8598]: Server listening on :: port 22.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325072446&siteId=291194637