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

参考:http://blog.csdn.net/mengjiangtao/article/details/24195523

sudo service ssh start

报错:

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

添加ssh.service

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
insserv: warning: script 'ssh' missing LSB tags and overrides
update-rc.d: error: ssh Default-Start contains no runlevels, aborting.

原因:/etc/init.d/ssh没有LSB tags。参考其他文件,格式如下:

#!/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

重新执行:

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.

 

转载于:https://my.oschina.net/apis/blog/1647729

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值