Connecting from iOS to macOS using ssh 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.
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.