199

How do you run a ssh server on Mac OS X?

3 Answers 3

243

Go to System Preferences -> Sharing, enable Remote Login.

2
  • 3
    ... and make sure the user is included in "Allow access for" -.-
    – d4Rk
    Nov 4, 2014 at 21:55
  • 2
    sudo systemsetup -setremotelogin on May 7, 2020 at 7:44
67

In System Preferences under Sharing, there is an option for Remote Login.

This will run sshd at startup (through launchd) and enable SSH access with standard options. To tweak the sshd options, edit /etc/sshd_config (or /private/etc/ssh/sshd_config in later versions) (you'll need to do this in a sudo shell or via sudo vi /etc/sshd_config).

3
  • 4
    Unfortunately, that config file won't allow you to edit the port used. To change the port, see serverfault.com/a/67616/102900. Oct 23, 2013 at 17:08
  • 1
    To restart ssh, turn Remote login off, and then turn it back on. No restart is required. Jun 7, 2016 at 13:40
  • 5
    OpenSSH sshd_config file is in /etc/ssh/sshd_config, never see it in /etc on any Linux distro or UNIX-like systems.
    – Terry Wang
    Apr 16, 2020 at 0:03
6

I'd prefer:

sudo systemsetup -setremotelogin on 
1
  • 1
    Turning Remote Login on or off requires Full Disk Access privileges
    – Att Righ
    Jun 16 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.