Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an iMac that I can access only in single user mode, because of serious hardware damage. I attached to it another computer with an Ethernet cable. I would like to login remotely to the iMac through SSH. The iMac is running OS X 10.6.4.

I came across similar answers but what I tried always failed.

I tried systemsetup -setremotelogin on and it returns the following error message:

systemsetup[63:903] setInetDServiceEnabled failed for ssh because authorizationRef is NULL!

While launchctl load -w /System/Library/LaunchDaemons/ssh.plist gives:

DNSServiceRegister("ssh"): -65563
DNSServiceRegister("sftp-ssh"): -65563
bind(): Can't assign requested address
launch_msg(): Socket is not connected
launchctl: CFURLWriteDataAndPropertiesToResource(/var/db/launchd.db/ failed: -10

What should I do?

share|improve this question
Can't assign requested address sounds to me like it doesn't have any kind of network connection. I think in single-user mode you'd have to use ifconfig or ifup to turn enable networking. – Blacklight Shining Jul 9 '12 at 10:17
@BlacklightShining thanks! I have little experience with these commands, I guess that with a Mac it would be more appropriate to use networksetup or ipconfig, however. Do you have an idea about what commands I should give in order for another computer to connect to the iMac via a single Ethernet cable? Or, in alternative, to connect the iMac to a wi-fi network protected with WPA2? – Ralphtor Jul 9 '12 at 11:44
I'm not sure myself. You can get the manual page for almost any program with man $program_name, by the way. I'll take a look and see if I can come up with something for you to try… – Blacklight Shining Jul 10 '12 at 11:57

Looks like you need to load some more plists:

launchctl load /System/Library/LaunchDaemons/
launchctl load /System/Library/LaunchDaemons/
launchctl load /System/Library/LaunchDaemons/
launchctl load /System/Library/LaunchDaemon/

Then do what you tried before:

launchctl load -w /System/Library/LaunchDaemons/ssh.plist
systemsetup -setremotelogin on

After that, I think you can simply plug the Ethernet cable into both computers to create an ad-hoc network. ifconfig en0 | grep inet on the target machine should get you its IP address, and then you're all set. :)

share|improve this answer
Thanks for your advice, the first commands were good. Unfortunately to the last command the computer answered with: DNSServiceRegister("ssh"): -65563, DNSServiceRegister("sftp-ssh"): -65563, with these two messages repeated twice. So I cannot connect with ssh. I remember vaguely to have changed the port for the incoming ssh connections, so it is probably my fault, but I would appreciate any help – Ralphtor Jul 10 '12 at 15:18
I must clarify: launchctl load -w /System/Library/LaunchDaemons/ssh.plistgives me the error I mentioned in the previous comment, while systemsetup -setremotelogin onkeeps giving setInetDServiceEnabled failed for ssh because authorizationRef is NULL! – Ralphtor Jul 10 '12 at 17:08
Do you remember how you changed the port? Could you maybe change it back? That might not do anything, but it's worth a try… – Blacklight Shining Jul 10 '12 at 21:09
I read the configuration files, it seems that the port is correctly set to 21. Probably this was not the problem because I followed the instructions for another Mac and ssh gave the same errors. For honesty sake the Mac I tested was a Mac mini with Lion and it complained that does not exist any more (as it was removed in Lion), but that should not be a big issue because ssh gave me exactly the same error as in the iMac. – Ralphtor Jul 11 '12 at 18:38

Three solutions you could consider. First, try target disk mode. If single user mode works, then target disk mode should work as well.

Once it is started in target disk mode, plug it into the other system you have (using firewire), and tell the second system to boot externally (hold down option on boot). Once the OS in the damaged system boots using the local systems hardware, open System Preferences and click on “Sharing” Select the checkbox next to “Remote Login” to enable it.

Shut down and restart, and you should have SSH up and running.

A second option is to remove the hard drive from the damaged system and boot from it externally (in an external enclosure) or place it inside your functional system and boot from there.

If neither of those work, but you are running single user, consider

cd /Library/Preferences
echo -n enabled >

This will turn on screen sharing, use that to access System Preferences on the remote machine, make the changes (turn on SSH) and you are functional.

share|improve this answer

Why not launching sshd directly? Once the network is up /usr/sbin/sshd -p 4212 will open a ssh server on port 4212.

share|improve this answer
Thanks for your answer. I executed the command (out of curiosity I'd like to ask why it was needed to write the complete path /usr/sbin/). If i run top on the iMac I see a process called sshd, so it should have worked. However when I connect with a computer with an Ethernet cable, look for the IP of the iMac with ifconfig, and run ssh -p 4212 on the other computer it says ssh: connect to host port 4212: Operation timed out – Ralphtor Jul 19 '12 at 22:33
I should also mention that shutdown -h now now does not work to shut down the iMac. I had to shut it down manually – Ralphtor Jul 19 '12 at 22:36
I tend to write full paths in my answers to avoid surprises due to badly configured PATH variables. I use that command often and it works for me, on 10.6 and 10.7, although not in single user mode I have to admit. Are you connecting in ssh as root? – cdelacroix Jul 20 '12 at 8:25
How do I connect as root? I tried ssh root@ -p 4212 and I even tried with the usernames of other accounts that are set up in the iMac and it always times out. If I use another port, instead of 4212 it complains "Connection refused", so something should be working, because it appears to answer to the right port. However I still can't connect – Ralphtor Jul 20 '12 at 12:05
The server might not be able to spawn a shell? You can try ssh -vvv root@ -p 4212 to see (really) verbose output from the client side, or even on the server side put ssh in debug mode to see what is happening (with sshd -d -p 4212). – cdelacroix Jul 20 '12 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .