ubuntu下如何安装使用SSH?

运维 系统运维
ubuntu默认并没有安装ssh服务,如果通过ssh链接ubuntu,需要自己手动安装ssh-server。判断是否安装ssh服务,可以通过如下命令进行:

ubuntu默认并没有安装ssh服务,如果通过ssh链接ubuntu,需要自己手动安装ssh-server。判断是否安装ssh服务,可以通过如下命令进行:

xjj@xjj-desktop:~$ ssh localhost

ssh: connect to host localhost port 22: Connection refused

如上所示,表示没有还没有安装,可以通过apt安装,命令如下:

-desktop:~$ sudo apt-get install openssh-server  

xjj@xjj-desktop:~$ sudo apt-get install openssh-server

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

@xjj-desktop:~$ sudo /etc/init.d/ssh start  

xjj@xjj-desktop:~$ sudo /etc/init.d/ssh start

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

@xjj-desktop:~$ ps -e|grep ssh   

6212 ?        00:00:00 sshd  

xjj@xjj-desktop:~$ ps -e|grep ssh 6212 ? 00:00:00 sshd

如上表示启动ok。注意,ssh默认的端口是22,可以更改端口,更改后先stop,

然后start就可以了。改配置在/etc/ssh/sshd_config下,如下所示。

xjj@xjj-desktop:~$ 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  

# Package generated configuration file

# See the sshd(8) manpage for details

# What ports, IPs and protocols we listen for

Port 22

***,应该是连接的时候了。请看如下命令:

xjj@xjj-desktop:~$ ssh exceljava@192.168.158.129  

xjj@xjj-desktop:~$ vi /etc/ssh/sshd_config

总结:

希望本文介绍的ubuntu下安装使用SSH的方法能够对读者有所帮助,更多有关linux系统的知识还有待于读者去探索和学习。

责任编辑:韩亚珊 来源: 博客转载
相关推荐

2011-08-30 15:53:07

Ubuntussh

2011-09-05 13:41:32

UbuntueCryptfs

2011-09-15 16:44:36

UbuntuGoldenDict

2011-03-10 08:59:04

Ubuntu安装LAMP

2016-01-04 13:52:12

UbuntuSwift安装

2011-09-15 10:52:09

2011-03-08 10:35:23

2011-09-02 19:26:38

2009-01-03 11:32:15

VistaUbuntuLinux

2011-09-07 16:00:28

Ubuntunetbook桌面环境

2011-03-22 10:25:54

UbuntuLAMP

2011-09-07 16:43:10

ubuntuwindowsXP

2009-12-31 13:45:32

2011-08-30 15:19:23

2009-03-11 19:48:32

LinuxUbuntuxdmcp服务

2011-08-16 18:26:52

Ubuntu

2011-08-29 14:12:50

UbuntuXBMC

2011-09-02 18:45:28

2011-09-06 15:10:20

Ubuntu图形界面

2011-03-14 13:07:23

Ubuntu安装LAMP
点赞
收藏

51CTO技术栈公众号