Ubuntu默认并没有安装ssh

前端之家收集整理的这篇文章主要介绍了Ubuntu默认并没有安装ssh前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Ubuntu默认并没有安装ssh服务,如果通过ssh远程连接到Ubuntu,需要自己手动安装ssh-server。
判断是否安装ssh服务,可以通过如下命令进行:
ps -e|grep ssh
输出如下:
zht@zht-Ubuntu:~$ ps -e|grep ssh
2151 ? 00:00:00 ssh-agent

5313 ? 00:00:00 sshd

ssh-agent表示ssh-client启动,sshd表示ssh-server启动了。

如果缺少sshd,说明ssh服务没有启动或者没有安装。
安装ssh-client命令: sudo apt-get install openssh-client

安装ssh-server命令:sudo apt-get install openssh-server

安装完成以后,先启动服务:sudo /etc/init.d/ssh start
启动后,可以通过“ps -e|grep ssh”查看是否正确启动。

ssh服务默认的端口是22,可以更改端口,使用如下命令打开ssh配置文件
vim /etc/ssh/sshd_config

配置文件内容如下:

  1. #Packagegeneratedconfigurationfile
  2. #Seethesshd(8)manpagefordetails
  3. #Whatports,IPsandprotocolswelistenfor
  4. Port22
  5. #Packagegeneratedconfigurationfile
  6. #Seethesshd(8)manpagefordetails
  7. #Whatports,IPsandprotocolswelistenfor

修改端口号(Port)后,重启ssh服务即可生效,命令如下:
sudo /etc/init.d/ssh restart

原文链接:https://www.f2er.com/ubuntu/355058.html

猜你在找的Ubuntu相关文章