Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 30, 2012, 09:25 AM   #1
adjplante
macrumors newbie
 
Join Date: Dec 2012
Location: Laval
SSH connection refused

Hi,

I use Mac OS X version 10.7.5 and my software is up to date.

Here is my problem: I tried to set ssh on my iMac. I am pretty sure that I am doing it OK since I have done this on my MacBook Pro, my girlfriend's iMac and it works fine there. But on my iMac when I type the same command in X11, that is:

ssh localhost

I get the following error:

ssh: connect to host localhost port 22: Connection refused

No matter what I do:
ssh andre@192.168.2.18
ssh andre@localhost
I always get the same error message.

Looks like ssh is working based on the (connect to host localhost port 22) of the error message but, on the other hand, I get the same message even if I turn off ssh by unchecking the Remote Login check box.

Any idea?

Thanks

André
adjplante is offline   0 Reply With Quote
Old Dec 30, 2012, 11:33 AM   #2
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by adjplante View Post
Hi,

I use Mac OS X version 10.7.5 and my software is up to date.

Here is my problem: I tried to set ssh on my iMac. I am pretty sure that I am doing it OK since I have done this on my MacBook Pro, my girlfriend's iMac and it works fine there. But on my iMac when I type the same command in X11, that is:

ssh localhost

I get the following error:

ssh: connect to host localhost port 22: Connection refused

No matter what I do:
ssh andre@192.168.2.18
ssh andre@localhost
I always get the same error message.

Looks like ssh is working based on the (connect to host localhost port 22) of the error message but, on the other hand, I get the same message even if I turn off ssh by unchecking the Remote Login check box.

Any idea?

Thanks

André
Try getting more information about what is going wrong by entering

Code:
ssh -vvv localhost
LPZ is offline   0 Reply With Quote
Old Dec 30, 2012, 12:31 PM   #3
adjplante
Thread Starter
macrumors newbie
 
Join Date: Dec 2012
Location: Laval
Quote:
Originally Posted by LPZ View Post
Try getting more information about what is going wrong by entering

Code:
ssh -vvv localhost
Thanks for the reply LPZ :-)

Here is the result
iMac-de-Andre:~ andre$ ssh -vvv localhost
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 22.
debug1: connect to address ::1 port 22: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
debug1: Connecting to localhost [fe80::1%lo0] port 22.
debug1: connect to address fe80::1%lo0 port 22: Connection refused
ssh: connect to host localhost port 22: Connection refused
I compared my /etc/ssh_config to the one on my MacBook Pro (on which ssh is working fine) and they are the same.
adjplante is offline   0 Reply With Quote
Old Dec 30, 2012, 02:13 PM   #4
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by adjplante View Post
Thanks for the reply LPZ :-)

Here is the result
iMac-de-Andre:~ andre$ ssh -vvv localhost
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 22.
debug1: connect to address ::1 port 22: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
debug1: Connecting to localhost [fe80::1%lo0] port 22.
debug1: connect to address fe80::1%lo0 port 22: Connection refused
ssh: connect to host localhost port 22: Connection refused
I compared my /etc/ssh_config to the one on my MacBook Pro (on which ssh is working fine) and they are the same.
I assume you have enabled Remote Login in the Sharing preference pane. What happens if you disable Remote Login and try

Code:
ssh -vvv localhost
again? Do you get exactly the same output as above?
LPZ is offline   0 Reply With Quote
Old Dec 30, 2012, 05:35 PM   #5
adjplante
Thread Starter
macrumors newbie
 
Join Date: Dec 2012
Location: Laval
Quote:
Originally Posted by LPZ View Post
I assume you have enabled Remote Login in the Sharing preference pane. What happens if you disable Remote Login and try

Code:
ssh -vvv localhost
again? Do you get exactly the same output as above?
Yes I have enabled Remote Login. If I disable it and run the ssh command I get the same error message. Looks like the enabling does not do its job!
adjplante is offline   0 Reply With Quote
Old Dec 30, 2012, 06:00 PM   #6
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by adjplante View Post
Yes I have enabled Remote Login. If I disable it and run the ssh command I get the same error message. Looks like the enabling does not do its job!
Let's try enabling it manually. Open Terminal (in Utilities) and enter

Code:
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
(Supply your password when it is requested) and then

Code:
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
Then try

Code:
ssh -v localhost
If this still fails to work, please enter

Code:
sudo launchctl list | grep "sshd"
If the ssh daemon was started in response to the ssh request (as it should have been) then you should see an output like

Code:
46427	-	com.openssh.sshd
(the number may be different).
LPZ is offline   0 Reply With Quote
Old Dec 30, 2012, 09:25 PM   #7
adjplante
Thread Starter
macrumors newbie
 
Join Date: Dec 2012
Location: Laval
Quote:
Originally Posted by LPZ View Post
Let's try enabling it manually. Open Terminal (in Utilities) and enter

Code:
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
(Supply your password when it is requested) and then

Code:
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
Then try

Code:
ssh -v localhost
If this still fails to work, please enter

Code:
sudo launchctl list | grep "sshd"
If the ssh daemon was started in response to the ssh request (as it should have been) then you should see an output like

Code:
46427	-	com.openssh.sshd
(the number may be different).
I did all the above and it still does not work, but I get a funny process number -

Code:
-       0       com.openssh.sshd
adjplante is offline   0 Reply With Quote
Old Dec 30, 2012, 09:59 PM   #8
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by adjplante View Post
I did all the above and it still does not work, but I get a funny process number -

Code:
-       0       com.openssh.sshd
That indicates that sshd was invoked and exited normally. So now the question is: Why is sshd not allowing the connection?

Have you modified /etc/sshd_config (the sshd configuration file) at all?

Perhaps someone who knows more about sshd can join in.
LPZ is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:10 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC