AllowGroups option in sshd_config do not accept group name that contains spaces.

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 5/6
  • openssh

Issue

  • Observed an issue with ssh AllowGroups when using ldap and the returned user group contains spaces.

  • Able to get ssh login authentication working with AllowGroups set to local groups and ldap groups with no spaces, however when add an ldap group with a space to this option, a user that relies on this group information to ssh into the server can not login and the error message in /var/log/secure is

Nov 12 13:17:39 server1 sshd[10324]: User foo from 192.168.5.1 not allowed because none of user's groups are listed in AllowGroups
Nov 12 02:17:39 server1 sshd[10325]: input_userauth_request: invalid user foo"

Resolution

  • As of now, RHEL5 does not have an option to specify user/group name with a space in it, openssh-server shipped with RHEL6 allows to use user/group name with space if the same is enclosed in double quotes.

    From man sshd_config:

Arguments may optionally be enclosed in double quotes (") in order to represent arguments containing spaces.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments