ubuntu实现远程登陆——ssh服务

Ubuntu安装使用SSH

ubuntu默认并无安装ssh服务,若是经过ssh连接ubuntu,须要本身手动安装ssh-server。ubuntu


一、判断是否安装ssh服务ssh

能够经过以下命令进行:ide

root@ubuntu:~#ssh localhost
spa

ssh: connect to host localhost port 22: Connection refused

二、安装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/

相关文章
相关标签/搜索