Enabling SSH in macOS through Terminal

Tags mac

Summary

This article will explain how to turn on remote login (SSH) on macOS computers from Terminal and add a user to the remote login group.

This also works remotely using Apple Remote Desktop, as long as Remote Management is enabled on the remote computer.

Environment

  • macOS
  • SSH

Directions

Modify SSH Service

  • Enable the service: sudo systemsetup -setremotelogin on
  • See the current remote login status: sudo systemsetup -getremotelogin
  • Disable remote login: sudo systemsetup -setremotelogin off

Add User to Remote Login Group

  • sudo dseditgroup -o edit -a USERENAME -t user com.apple.access_ssh
  • You can also add the user via System Settings > General > Sharing > Remote Login

Details

Article ID: 1970
Created
Fri 5/29/20 1:52 PM
Modified
Thu 1/25/24 4:51 PM