I want to control who can log in via SSH on my server. Is it safe to add the group 'ssh' to the users who are allowed to login in?

I see some distros use system groups in the user's ID and others recommend creating new groups. For example, some users will have the sudo group and other distros recommend creating a new group gSudo and adding it to the sudoers file.

  • I am not sure off hand what the ssh group is for.. but it's not for that. So I suppose if you want to create a group, you should create a new user group. But you could also add individual users instead. So, you can set ssh up as a whitelist i.e. to not allow anybody except, those users or groups.
    – barlop
    Jan 3, 2016 at 7:46

1 Answer 1


The purpose of ssh group was described on Unix. There is no gain by adding user to ssh group, because the group is used only for pre-authentication process.

If you want to use a group to limit who can log in to your server using ssh, create a group sshuser, add AllowGroups sshuser to your /etc/ssh/sshd_config and restart your ssh service.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .