您当前的位置: 首页 >  ubuntu

ITKEY_

暂无认证

  • 0浏览

    0关注

    732博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

ubuntu开启ssh服务

ITKEY_ 发布时间:2021-11-27 22:36:20 ,浏览量:0

环境

我的测试环境是:docker中的Ubuntu 20.04.3 LTS

安装openssh-server
sudo apt update
sudo apt install openssh-server
查看服务状态

安装完成后,SSH服务将自动启动。要验证安装是否成功并且SSH服务正在运行,请键入以下命令,该命令将显示SSH服务器状态。

service ssh status
#或者
sudo systemctl status ssh
常见错误

执行以下命令后,发现报错了。

systemctl start ssh

System has not been booted with systemd as init system (PID 1). Can’t operate.

原因是你想用systemd命令来管理Linux上的服务,但你的系统并没有使用systemd,(很可能)使用的是经典的SysV init(sysvinit)系统。

尝试用以下命令替换:

Systemd commandSysvinit commandsystemctl start service_nameservice service_name startsystemctl stop service_nameservice service_name stopsystemctl restart service_nameservice service_name restartsystemctl status service_nameservice service_name statussystemctl enable service_nameservice service_name onsystemctl disable service_nameservice service_name off 参考

https://segmentfault.com/a/1190000022103074

https://www.cnblogs.com/a5idc/p/13752839.html

关注
打赏
1665243900
查看更多评论
立即登录/注册

微信扫码登录

0.0454s