在Ubuntu中配置SSH(解决connect to host localhost port 22: Connection refused问题)

成功地装ssh需要三步。

第一步,在https://launchpad.net/ubuntu/lucid/i386/openssh-client/1:5.3p1-3ubuntu3下载文件并安装。

第二步,在https://launchpad.net/ubuntu/lucid/i386/openssh-server/1:5.3p1-3ubuntu3下载文件并安装。

第三步,在https://launchpad.net/ubuntu/lucid/i386/ssh/1:5.3p1-3ubuntu3下载文件并安装。

下载并安装第一个文件

hadoopr@ubuntu:~/Downloads$ sudo dpkg -i openssh-client_5.3p1-3ubuntu3_i386.deb 
dpkg: warning: downgrading openssh-client from 1:5.3p1-3ubuntu5 to 1:5.3p1-3ubuntu3.
(Reading database ... 127436 files and directories currently installed.)
Preparing to replace openssh-client 1:5.3p1-3ubuntu5 (using openssh-client_5.3p1-3ubuntu3_i386.deb) ...
Unpacking replacement openssh-client ...
Setting up openssh-client (1:5.3p1-3ubuntu3) ...
Processing triggers for man-db ...

下载并安装第二个文件

hadoopr@ubuntu:~/Downloads$ sudo dpkg -i openssh-server_5.3p1-3ubuntu3_i386.deb 
Selecting previously deselected package openssh-server.
(Reading database ... 127436 files and directories currently installed.)
Unpacking openssh-server (from openssh-server_5.3p1-3ubuntu3_i386.deb) ...
Setting up openssh-server (1:5.3p1-3ubuntu3) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
 * Stopping OpenBSD Secure Shell server sshd                                                              [ OK ] 
ssh start/running, process 3822
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw ...
Processing triggers for man-db ...

下载并安装第三个文件

hadoopr@ubuntu:~/Downloads$ sudo dpkg -i ssh_5.3p1-3ubuntu3_all.deb 
(Reading database ... 127454 files and directories currently installed.)
Preparing to replace ssh 1:5.3p1-3ubuntu3 (using ssh_5.3p1-3ubuntu3_all.deb) ...
Unpacking replacement ssh ...
Setting up ssh (1:5.3p1-3ubuntu3) ...

最后试了试,成功。

hadoopr@ubuntu:~/Downloads$ ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is 0f:f5:b7:32:06:a3:3c:4c:de:fb:04:aa:8a:f2:2d:ee.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.

posted @ 2013-07-27 14:32  小黑03  阅读(11232)  评论(0编辑  收藏  举报