How do I block SSH access on Mac OSX?

6,896

How do I block login access to SSH?

You should run the following command from the command line.

sudo systemsetup -setremotelogin off

It might be worth pointing out, that the command will prompt you, to confirm you actually want this feature off.

When you successfully execute the command, you will be asked: “Do you really want to turn remote login off? If you do, you will lose this connection and can only turn it back on locally at the server (yes/no)?” so type “yes” to confirm, which will disable SSH and also disconnect any active SSH connections to the Mac in question.

You can avoid that prompt by using the following command.

sudo systemsetup -f -setremotelogin off

Sources

Share:
6,896
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    Hackers have gained root access my Mac OS X using SSH remote access and automatic WiFi login. How do I block login access to SSH?

    • Ramhound
      Ramhound over 6 years
      Please edit your question to include the output, of the following command, sudo systemsetup -getremotelogin
    • Giacomo1968
      Giacomo1968 over 6 years
      How do you know this has happened? Unless remote login is enabled in the sharing panel under system access nobody should have SSH access.
    • Tetsujin
      Tetsujin over 6 years
      The root bug was only publicly known for 24h before Apple released a patch. If you haven't yet updated... now would be the time. Otherwise, there is no route to root on a Mac; it is disabled by default so you would have had to manually open that door.