How to enable and disable SSH on Mac through the terminal

Generally, newer Mac devices will have SSH pre-installed by default, but the SSH daemon is disabled by default, so how to enable it, let’s talk about it below.

1. Introduction

SSH is the abbreviation of Secure Shell, developed by the Network Working Group of IETF; SSH is a security protocol based on the application layer. SSH is currently the most reliable protocol designed to provide security for remote login sessions and other network services. Using the SSH protocol can effectively prevent information leakage in the remote management process. SSH was originally a program on UNIX systems, and then quickly expanded to other operating platforms. SSH, when used correctly, closes holes in the network. SSH clients are available for a variety of platforms. Almost all UNIX platforms—including HP-UX, Linux, AI X, Solaris, Digital UNIX, Irix, and others—can run SSH.

2. Check whether SSH is enabled

Detection command: sudo systemsetup -getremotelogin

As shown below: (closed state)

3. Turn on and off SSH 

Open command: sudo systemsetup -setremotelogin on 

Off command: sudo systemsetup -setremotelogin off

 

Guess you like

Origin blog.csdn.net/lilapliua/article/details/126584718