Mac – How to block SSH access on Mac OSX


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?

Best Answer

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


Related Question