zoukankan      html  css  js  c++  java
  • 启动SSH服务出现problem conclusion

    使用apt-get install openssh-server安装SSH后,使用service sshd start开启SSH服务时提示:

    Failed to start sshd.service: Unit sshd.service not found.
    解决方案:

    添加ssh.service

    systemctl enable ssh.service

    最近在学linux,使用ssh远程登陆linux,记录下来!

    首先进入/etc目录下,/etc目录存放的是一些配置文件,比如passwd等配置文件,要想使用ssh远程登陆,需要配置/etc/ssh/sshd_config文件里的配置信息,使用vim编辑,在命令行模式下输入 vim /etc/ssh/sshd_config,进入之后,按“i”进入编辑状态,在其文件里找到并修改为:PasswordAuthentication yes , PermitRootLogin yes两行即可,

     

    修改之后,按“esc”退出,并按“:wq”保存并退出,或直接按“:x”直接保存退出,(注意:此处的x为小写x,大写X是将文件内容加密,使用时细心注意),

    退出编辑模式之后,回到命令模式,输入 sevice ssh start/stop/restart/status,启动/停止/重启/状态,选择start启动ssh服务。

     

    如果上面开启SSH服务的命令不能用,可以使用命令:sudo service sshd start 试试,检查是否开启SSH服务使用命令:ps -e | grep sshd

    此时可以查看ssh状态是否为运行状态,运行状态即可使用ssh远程登陆。

    使用“ifconfig”命令查询ip地址

    使用ssh登陆时,输入主机(linux的ip地址),账号,密码登陆!

    如果需要远程连接SSH,需要把22端口在防火墙上开放,关闭防火墙,或者设置22端口例外  /etc/init.d/iptables stop

    怎么通过ssh登陆可参看下一篇“通过ssh实现远程登陆服务器!”

    大致步骤为:

    SSH 服务配置文件位置
    /etc/ssh/sshd_config

    # 修改配置
    PasswordAuthentication yes
    PermitRootLogin yes

    # 启动SSH 服务
    sevice ssh start/stop/status

    安装SSH:yum install ssh
    启动SSH: service sshd start

    设置开机运行: chkconfig sshd on

  • 相关阅读:
    数据结构总结(UPDATING......)
    课件例题4.11,4.12
    Luogu P1525 关押罪犯
    Luogu P1540 机器翻译
    Luogu P1313 计算系数
    Luogu P1311 选择客栈
    Luogu P1519 穿越栅栏 Overfencing
    Luogu P2863 [USACO06JAN]牛的舞会The Cow Prom
    Tarjan学习笔记
    Luogu P3393 逃离僵尸岛
  • 原文地址:https://www.cnblogs.com/klausage/p/14534972.html
Copyright © 2011-2022 走看看