
If you want to disable SSH servers from the command line and thereby prevent remote connections, simply switch ‘on’ to ‘off’ with the -setremotelogin flag of systemsetup like so:Īgain, sudo is necessary to toggle SSH off and disable the ssh and sftp servers.
#EXCHANGE CAPABLE EMAIL FOR MAC FULL#
Ssh connected, the user will have remote access to the computer via the command line, and if they have an admin account or admin password, they would have full remote administration access as well. Once ssh has been enabled, any user account or person who has a login on the current Mac can access it remotely using the ssh command aimed at the Macs IP address like so: And yes, using -setremotelogin applies to enabling both ssh and sftp servers on the Mac. There is no confirmation or message that Remote Login and SSH has been enabled, but you can use the aforementioned -getmorelogin flag to check and verify that SSH server is indeed now running. Sudo is necessary because the systemsetup command requires administrator privileges, just like when you enable Remote Login from the Sharing preferences on a Mac to enable the secure shell servers. To quickly turn on SSH server and allow incoming ssh connections to the current Mac, use the -setremotelogin flag with systemsetup like so: Enable SSH on Mac from the Command Line with systemsetup If remote login and SSH is currently enabled, the command and report will say “Remote Login: On” whereas if SSH is disabled and in the default macOS state, it will say “Remote Login: Off”. Want to check the current status of SSH on a Mac? Using the systemsetup command string we can quickly determine if SSH and Remote Login is currently enabled on any Mac:
#EXCHANGE CAPABLE EMAIL FOR MAC HOW TO#
How to Check if SSH Remote Login is Enabled in Mac OS via Terminal

If you do not regularly use ssh, there is no reason to enable the ssh server on a Mac.

If you want to toggle SSH off and on and avoid the command line, you can do so by enabling Remote Login in the Sharing preference panel on a Mac, or stop the server by leaving it unchecked. A quick side note this guide applies to all versions of macOS and Mac OS X, but is really aimed at more advanced users who spend a lot of time in the Terminal.
