Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

adjplante

macrumors newbie
Original poster
Dec 30, 2012
5
0
Laval
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é
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
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
 

adjplante

macrumors newbie
Original poster
Dec 30, 2012
5
0
Laval
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.
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
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?
 

adjplante

macrumors newbie
Original poster
Dec 30, 2012
5
0
Laval
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!
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
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).
 

adjplante

macrumors newbie
Original poster
Dec 30, 2012
5
0
Laval
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
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.