linux服务器修改密码登录Failed to restart ssh.service: Unit ssh.service not found

刚买了台服务器,登录时需要修改密码;

https://cloud.tencent.com/document/product/1207/44569#ubuntu-.E7.B3.BB.E7.BB.9F.E5.A6.82.E4.BD.95.E4.BD.BF.E7.94.A8-root-.E7.94.A8.E6.88.B7.E7.99.BB.E5.BD.95.E5.AE.9E.E4.BE.8B.EF.BC.9F

但是到这里要修改sshd_config文件可以允许密码登录的时候,发现修改完成,无法重启

出现如下错误:

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

实际是因为,版本问题导致,以上命令都是centos6里面的命令,在centos7需要用:

systemctl restart sshd

完美解决~~~


 

posted @ 2021-09-19 19:58  进阶的蜗牛  阅读(2606)  评论(0编辑  收藏  举报