环境

操作系统:CentOS 7

问题

重启ssh服务,启动报错:Failed to restart ssh.service: Unit not found.

操作步骤

1. 编辑sshd_config文件

vim /etc/ssh/sshd_config

2. 重启ssh服务

service ssh restart

3. 启动失败,报错

Redirecting to /bin/systemctl restart ssh.service
Failed to restart ssh.service: Unit not found.

解决方案

从 CentOS 7.x 开始,CentOS 开始使用 systemd 服务来代替 daemon,原来管理系统启动和管理系统服务的相关命令全部由 systemctl命令来代替。

# CentOS 7
systemctl restart sshd # CentOS 6
service restart sshd

扩展知识

service 和 systemctl 命令

Failed to restart ssh.service: Unit not found.的更多相关文章

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

    Failed to start ssh.service: Unit not found. 报错内容: [Centos7@localhost ~]$ service ssh start Redirect ...

  2. docker报错:Failed to restart docker.service: Unit not found.

    前言:我之前安装好docker了,但是关机重启后,发现docker就没了 报错:Failed to restart docker.service: Unit not found.   解决方法: 1. ...

  3. mysqld服务启动失败, Failed to restart mysqld.service: Unit not found.

    -bash-4.2# service mysqld restart Redirecting to /bin/systemctl restart mysqld.serviceFailed to rest ...

  4. Redirecting to /bin/systemctl restart mysql. service Failed to restart mysql.service: Unit not found.

    使用如下命令操作mysql即可: systemctl restart mysqld.service systemctl start mysqld.service systemctl stop mysq ...

  5. 最新cenos执行service httpd restart 报错Failed to restart httpd.service: Unit not found.

    原来是需要将Apache注册到Linux服务里面啊!注册Apache到Linux服务在Linux下用源代码方式编译安装完Apache后,启动关闭Apache可以通过如下命令实现: /usr/local ...

  6. 【解决】Failed to restart network.service: Unit network.service not found.

    问题:使用systemctl restart network 或 service network restart 命令重启网卡失败. 分析:原因其实也很简单,命令用错了,造成了找不到相应的网卡服务. ...

  7. Failed to restart docker.service: Unit not found 镜像加速

    解决方案 以前的安装残留 重新安装 find / -name "docker*" centos8 添加软件源信息 yum-config-manager --add-repo htt ...

  8. CentOS 7 防火墙 出现Failed to start iptables.service: Unit iptables.service failed to load

    错误信息如下: [root]# service iptables start Redirecting to /bin/systemctl start iptables.service Failed t ...

  9. Linux_异常_03_Failed to restart iptables.service: Unit not found.

    启动防火墙时出现: Failed to restart iptables.service: Unit not found. 解决方案: 1.https://stackoverflow.com/ques ...

随机推荐

  1. Spring Boot Admin,贼好使!

    Spring Boot Admin(SBA)是一个开源的社区项目,用于管理和监控 Spring Boot 应用程序.应用程序可以通过 http 的方式,或 Spring Cloud 服务发现机制注册到 ...

  2. UML 有关类图知识及类间关系

    原文链接:https://blog.csdn.net/mj_ww/article/details/53020346 1. 类的含义 类图(Class diagram)显示了系统的静态结构,而系统的静态 ...

  3. 云图说|DDS读写两步走,带您领略只读节点的风采

    摘要:为了扩展主节点的读请求能力,DDS提供具备独立连接地址的只读节点,适合独立系统直连访问,以缓解大量读请求给主节点造成的压力. 本文分享自华为云社区<[云图说]第235期 DDS读写两步走 ...

  4. C++11多线程之future(一)

    // ConsoleApplication5.cpp : 定义控制台应用程序的入口点. #include "stdafx.h" #include<random> #in ...

  5. Redisson 实现分布式锁原理分析

    Redisson 实现分布式锁原理分析   写在前面 在了解分布式锁具体实现方案之前,我们应该先思考一下使用分布式锁必须要考虑的一些问题.​ 互斥性:在任意时刻,只能有一个进程持有锁. 防死锁:即使有 ...

  6. gorm中的基本查询

    检索单个对象 GORM 提供了 First.Take.Last 方法,以便从数据库中检索单个对象.当查询数据库时它添加了 LIMIT 1 条件 // 获取第一条记录(主键升序) db.First(&a ...

  7. java匿名内部类-应用

    1 package face_09; 2 3 import sun.jvm.hotspot.ui.action.ShowAction; 4 5 interface Inter{ 6 void show ...

  8. 关于new Date总结及注意事项

    记录关于 new Date() 的一些常用方法及问题 new Date()基本方法: 创建一个日期对象的几种方法 注意: 由于浏览器差异和不一致性,强烈建议不要使用Date构造函数(和Date.par ...

  9. ddos攻击是什么,如何防御

    DDoS(Distributed Denial of Service,分布式拒绝服务) 定义: 主要通过大量合法的请求占用大量网络资源,从而使合法用户无法得到服务的响应,是目前最强大.最难防御的攻击之 ...

  10. ubuntu16.04同时使用 pyhton2.7和3.5,并随意切换

    ubuntu16.04中默认已经安装了python2.7和python3.5 hanli@ubuntu:/usr/bin$ ls |grep python dh_python2 dh_python3 ...