While configuring Ubuntu for PostgreSQL, when I was trying to connect Ubuntu server, I got following error message:
edbs-MacBook-Pro:~ vibhor$ ssh vibhor@172.16.82.130 ssh: connect to host 172.16.82.130 port 22: Connection refused
To resolve this issue, I have found that installation of Ubuntu 10.10 doesn’t have openssh-server installed due to which Message was coming, so I have installed openssh-server using following command as given below:
root@ubuntu:~# apt-get install openssh-server Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-2.6.35-22 linux-headers-2.6.35-22-generic Use 'apt-get autoremove' to remove them. Suggested packages: rssh molly-guard openssh-blacklist openssh-blacklist-extra The following NEW packages will be installed: openssh-server 0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded. Need to get 302kB of archives. After this operation, 819kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ maverick-updates/main openssh-server i386 1:5.5p1-4ubuntu5 [302kB] Fetched 302kB in 5s (52.0kB/s) Preconfiguring packages ... Selecting previously deselected package openssh-server. (Reading database ... 147353 files and directories currently installed.) Unpacking openssh-server (from .../openssh-server_1%3a5.5p1-4ubuntu5_i386.deb) ... Processing triggers for ureadahead ... Processing triggers for ufw ... Processing triggers for man-db ... Setting up openssh-server (1:5.5p1-4ubuntu5) ... 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 17665
After installation, I was able to connect to Ubuntu Server:
edbs-MacBook-Pro:~ vibhor$ ssh vibhore@172.16.82.130 vibhore@172.16.82.130's password: Linux ubuntu 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:40:58 UTC 2011 i686 GNU/Linux Ubuntu 10.10 Welcome to Ubuntu! * Documentation: https://help.ubuntu.com/ 7 packages can be updated. 0 updates are security updates. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
To fix the above ssh connection issue, user can execute following command to check if ssh daemon is running or not:
ps -eaf|grep sshd
If sshd is running fine, user can also check if firewall is suppressing the port 22.
netstat -nav|grep :22
After fixing the issue from firewall, user can restart the services as given below:
/etc/init.d/ssh restart
Thankx alot man, It worked. i’ve been trying by hard to ssh to my hostname. I did run the openssh and voalla!
I just forgot to enable the service in my remote machine. and i followed your guide its working well. Thanks for the guide..
It was nice reading this, I was expecting ssh stuff installed, usually. I have just learned this: sometimes it is not. But after installation all which is need is tell “yes” for the new host you are going to use. For more security it is best to generate public key at both machines, ssh-keygen will do that.