ubuntu如何安装和开启ssh服务

用Xshell连接不上Linux
错误页面提示:

Connecting to 172.17.11.147:22...
Could not connect to '172.17.11.147' (port 22): Connection failed.
Type `help' to learn how to use Xshell prompt.

出现这种情况的原因:

1.服务器端防火墙关闭了22端口,没有开启ssh服务;

2.由于Ubuntu默认没有安装ssh;

  1. 通过ssh链接ubuntu,需要自己手动安装ssh-server。判断是否安装ssh服务

    ssh localhost
    如果显示 : ssh: connect to host localhost port 22: Connection refused 等错误信息,则需要安装

  2. 通过apt安装,命令如下:

    sudo apt-get install openssh-server

  3. 系统将自动进行安装,安装完成以后,先启动服务:

    service ssh start

    ssh start/running, process 3582

    sudo /etc/init.d/ssh start

  4. 启动后,可以通过如下命令查看服务是否正确启动

    ps -e | grep ssh

    2152 ? 00:00:00 ssh-agent

    3582 ? 00:00:00 sshd

猜你喜欢

转载自blog.csdn.net/weixin_43170297/article/details/89226094
今日推荐