sshd 服务问题,怎么做成系统启动,6.9靠谱吗?

  1. 安装了CentOS-7-x86_64-Minimal-1611
  2. 运行命令yum install -y openssh-server,第一遍没有-y,后来reinstall的
  3. /etc/init.d/目录下没有sshd这个文件,
  4. 相关的什么check也不行,怎么做成系统启动?

        炒蛋啊!
        有6.9这个版本靠谱吗?
阅读 4.1k
5 个回答

service sshd start 不行就试试 systemctl enable sshd.service

在Centos7中,Systemd进程取代了init进程,systemctl代替service和chkconfig两个命令。
启动sshd服务:

systemctl start sshd.service

重启sshd服务:

systemctl restart sshd.service

设置sshd服务开机自启:

systemctl enable sshd.service

7版本和6版本在服务的管理上有很大的区别,你提到打得“/etc/init.d/”是6版本的形式,现在7统一用命令systemctl对服务进行统一管理。具体细节请参考systemctl相关命令的文档说明.
(1)设置开机自启动服务:systemctl enabled sshd.servicesystemctl enabled sshd
(2)设置临时启动服务:systemctl start sshd.servicesystemctl start sshd
(3)设置临时关闭服务:systemctl stop sshd.servicesystemctl stop sshd
(4)设置重启服务:systemctl restart sshd.servicesystemctl restart sshd

minimal自带ssh服务,只需要service ssh start 启动,然后chkcofig --level 2345 sshd on 开启开机自启动即可。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题