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