setp1:检查是否安装了ssh
命令:
dpkg --list|grep ssh
出现:
ii libssh-4 0.4.2-1ubuntu1 A tiny C SSH library
ii openssh-client 1:5.3p1-3ubuntu4 secure shell (SSH) client, for secure access
ii openssh-server 1:5.3p1-3ubuntu4 secure shell (SSH) server, for secure access
ii ssh-askpass-gnome 1:5.3p1-3ubuntu4 interactive X program to prompt users for a
如果有openssh-client 和openssh-server 则是已安装
如果没有安装,可输入以下命令:
sudo apt-get install openssh
step2:检测是否启动ssh
命令:
ps -ef|grep ssh
出现:
root 684 1 0 22:40 ? 00:00:00 /usr/sbin/sshd
frankwoo 2329 2285 0 22:43 ? 00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
root 31254 684 0 23:49 ? 00:00:00 sshd: root@pts/2
root 31408 31341 0 23:58 pts/2 00:00:00 grep --color=auto ssh
如果有ssh字眼,则表明已启动。
如果没有启动,输入以下命令:
/etc/init.d/ssh start
启动后出现:
* Starting OpenBSD Secure Shell server sshd [ OK ]
表明启动成功
step3:在Windows环境下,使用putty或secureCRT连接测试
我这里用的是putty。
因为要输入IP。这里我在ubuntu里输入命令:
ifconfig
因为是使用虚拟机VMware,并以Bridged方式连接,因此只需看eth0这部分,命令输入后找到inet字眼,后面的IP就是你在Putty新建的connection里需要输入的IP。用图比较直观,可见下图:
就是Hostname输入的那个IP,点击Open。如果能成功连接,则表明在ubuntu下开启ssh服务完全成功。