1

Because of the OpenSSH iOS tweak and NewTerm (my phone is jailbroken), I'm able to connect from my computer to my phone using ssh:

$ ssh mobile@myphonesip
mobile@myphonesip's password: 
myphonesname~ mobile$

This is pretty great and all, but I would also like to connect to my computer from my phone using ssh. I've set up a ssh key on my mac, but this is what I get when trying to connect to it from my phone:

$ ssh myusername@mycomputersip
ssh: connect to host mycomputersip port 22: Connection refused

I've also tried connecting to root because I have that set up:

$ ssh root@mycomputersip
ssh: connect to host mycomputersip port 22: Connection refused

TJ Luoma suggested that I might have to start ssh on my computer with this:

sudo launchctl start com.openssh.sshd

I did that and tried to connect again.

I've also enabled remote login in system preferences.

I've tried with my firewall disabled. I've also disabled Stealth Mode. Does anyone have an idea of how I can connect to my computer from my phone?


Update: something has made this work (remote login I think), but when I try to connect, I get this:

$ ssh root@mycomputersip The authenticity of host 'mycomputersip (mycomputersip)' can't be established. ECDSA key fingerprint is SHA256:verylongstringofnumbersandletters. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'mycomputersip' (ECDSA) to the list of known hosts. Password: Password: Password: root@mycomputersip's password: Permission denied, please try again. root@mycomputersip's password: Received disconnect from mycomputersip port 22:2: Too many authentication failures Authentication failed.

or this:

$ ssh myusername@mycomputersip ssh: connect to host mycomputersip port 22: Host is down

or this:

$ ssh myusername@mycomputersip ssh: connect to host mycomputersip port 22: Operation timed out

and when I try to connect to my phone I either get this:

$ ssh root@myphonesip root@myphonesip's password: Authentication failed.

or this:

$ ssh mobile@myphonesip ssh: connect to host myphonesip port 22: Operation timed out

Something is really screwy right now. I can only connect to my phone sometimes through terminal. I know that ssh is working though because I can connect to my phone using Mountain Duck perfectly fine.

4
  • I've removed your update, as it completely changed the focus of your question. If enabling SSH login via GUI or command line enabled login to your computer, please accept the answer below and ask a new question for the new problem.
    – nohillside
    Commented Jan 9, 2019 at 12:30
  • It did not enable connection to my computer @nohillside
    – Sam
    Commented Jan 9, 2019 at 15:11
  • and I can't connect to my phone via ssh anymore
    – Sam
    Commented Jan 9, 2019 at 15:11
  • Then please add that you‘ve enabled ssh access in SStem Preferences. Might be a more general problem though
    – nohillside
    Commented Jan 9, 2019 at 15:21

1 Answer 1

2

Using the GUI

This is the easier way to do it:

Go to System Preferences.app then go to "Sharing" and then enable "Remote Login"

Using the Command Line:

If you insist on using the command line, I think the command you're looking for is:

sudo launchctl start com.openssh.sshd

I think the syntax may vary somewhat if you are using an older version of macOS you are running, but I don't remember when that might have changed, so I can't say for sure.

2
  • Now that I've done that, I can't connect to my phone from my computer with ssh
    – Sam
    Commented Jan 9, 2019 at 6:04
  • Thanks, a whole after enabling remote login it worked
    – Sam
    Commented Jan 10, 2019 at 7:45

You must log in to answer this question.

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