Does anybody know what is the command to allow "Only these users" into remote login for mac ?

I have enable the remote login via terminal using " sudo systemsetup -setremotelogin on "

I will need to add a username into allow access only for that particular user.


| improve this question | | | | |

The list of users is controlled by the com.apple.access_ssh group.

  • If the group doesn't exist, Remote Login is set to ‘All users’.
  • If the group exists and has members, Remote Login is set to ‘Only these users’.
  • If Remote Login is disabled, the group is renamed com.apple.access_ssh-disabled which preserves members for when it is enabled.

You can see the group and manually edit it using Workgroup Manager without Terminal for testing.

Workgroup Manager showing SSH Service ACL group

To reset all settings and enable Remote Login, you can run the following. In my testing, it has not been necessary to disable remote login using the first command, but I include it for completeness.

sudo systemsetup -setremotelogin off
dseditgroup -o delete -q com.apple.access_ssh
dseditgroup -o delete -q com.apple.access_ssh-disabled
sudo systemsetup -setremotelogin on

To add a user to the group using the command line, you can use dseditgroup, replacing ‘username’ with the username of the user to grant access to.

dseditgroup -o create -q username -t user com.apple.access_ssh
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.