ubuntu默認並無安裝ssh服務,若是經過ssh連接ubuntu,須要本身手動安裝ssh-server。ubuntu
一、判斷是否安裝ssh服務ssh
能夠經過以下命令進行:ide
root@ubuntu:~#ssh localhost |
二、安裝ssh服務server
如上所示,表示沒有尚未安裝,能夠經過apt安裝,命令以下:blog
root@ubuntu:~#apt-get install openssh-server |
三、啓動ssh服務
進程
系統將自動進行安裝,安裝完成之後,先啓動服務:get
root@ubuntu:~#/etc/init.d/ssh start 或 service sshd start |
四、查看ssh進程
it
啓動後,能夠經過以下命令查看服務是否正確啓動io
root@ubuntu:~#ps -e|grep ssh 6212 ? 00:00:00 sshd |
五、更改ssh端口
如上表示啓動ok。注意,ssh默認的端口是22,能夠更改端口,更改後先stop,而後start就能夠了。改配置在/etc/ssh/sshd_config下,以下所示。
root@ubuntu:~#vi /etc/ssh/sshd_config # Package generated configuration file # See the sshd(8) manpage for details # What ports, IPs and protocols we listen for Port 22 |
最後,應該是鏈接的時候了。請看以下命令:root@ubuntu:~# ssh jiangzhi@192.168.0.100
http://xiangyanglai.blog.163.com/blog/static/20472520220111025115826821/