View Full Version : [ubuntu] Port 22 Connection refused

Ian McDonagh
March 9th, 2010, 05:25 AM
new build running Umbutu 9.10
Mac Running 10.5.8

First off I'm a total noob to Linux systems and I have tried googling everything I can think of to resolve this issue found many people getting similar issues but no one with the exact symptoms and all the suggested fixes thus far have failed.

I am trying to set up ssh server on Umbutu and I believe I have successfully started it with the ((sudo apt-get install ssh)) command. No I'm trying to log onto my Umbutu box from my mac and I constantly get the error
ssh: connect to host XX.XX.XXX.XX (not the port 22: connection refused
When I try and run the same thing from Umbutu it just jumps to the next line like I hit enter on an empty line.

I have made sure ssh is installed and running on the umbutu system several times and I have the remote login checked on my mac.
I am at a total loss at this point PLEASE someone help I have been at this two nights straight and have made very little headway.

Thanks in advance.

March 9th, 2010, 05:29 AM
maybe this will help. I just set up three computers to share files.


March 9th, 2010, 05:37 AM
apt-get update
apt-get install openssh-server

Ian McDonagh
March 9th, 2010, 07:30 PM
I've already ran the install comands I will try the guide and I'll run the install comands again to confirm

March 9th, 2010, 09:05 PM
I've already ran the install comands I will try the guide and I'll run the install comands again to confirm

i think wirelessmonkey was suggesting those particular commands to make sure you installed the ssh SERVER, because your initial post said you entered 'sudo apt-get install ssh'...

March 9th, 2010, 09:32 PM
Check to make sure sshd is running:

ps aux | grep sshd

Also check to make sure it's listening on the port you want:

sudo netstat -punta

Should have a line similar to:

tcp 0 0* LISTEN 16097/sshd

Where 22 is the port number.

Once those are confirmed, we can move on.

ALSO: Is the machine you are connecting FROM, inside the network, or outside the network? Connection refused will happen if you are either outside of the network and not forwarding ports, or if the firewall is not allowing the connection.

March 9th, 2010, 11:39 PM
Firewalls can also be a problem - if you have one running (on either/both machines).

Ian McDonagh
March 10th, 2010, 04:56 AM
When I run the sudo netstat -punta command this is what I get (I think this is what it's supposed to look like)

tcp6 0 0 ::1:631 :::* LISTEN

And when I run ps aux | grep sshd I get this

root 1095 0.0 0.0 5364 1036 ? Ss 22:25 0:00 /usr/sbin/sshd
ian 2115 0.0 0.0 3044 868 pts/0 S+ 22:51 0:00 grep --color=auto sshd

When I run this apt-get update I get this (I think this is where the problem lies when I'm trying to access something seeing lock is never good)

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock the list directory

And this command apt-get install openssh-server gives this

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

I'm totally at a loss here. I don't understand yesterday I was thinking it was an issue on the mac side but now I'm realizing it's an issue on this end and I am out of my depth with this.

March 10th, 2010, 04:29 PM
It should be sudo apt-get or whatever. You need to use the sudo command first.

Ian McDonagh
March 11th, 2010, 01:12 AM
I'm an idiot once they're connected under the hard drive icon on the mac there's a shared icon. I just click on that click connect punch in my password and hit screen share

March 11th, 2010, 02:05 AM
[SOLVED] (https://wiki.ubuntu.com/UnansweredPostsTeam/SolvedThreads)?