5

Is it possible to add a name as a group member when the name has a space? For example "foo bars" is the name and I want it to add to the group called "reindeers".

This group is created in AD and it is quite common for names to have spaces. I won't be able to change the name.

Apologies if this has already been asked here. I just could not find any references. I did find solutions/discussions to adding a username with a space in the sudoers config file by replacing the space with a "_" instead, or escaping the space with a backslash. Not sure if this works with regards to adding it to a group.

Thanks, Mrky

  • Did you try "%20"? – Ignacio Vazquez-Abrams Nov 1 '17 at 4:19
  • 1
    You want to add a group (that has a space in it) into another group? How does that work on unix? – thrig Nov 1 '17 at 4:22
  • Won't "%20" be treated literally instead in this case? – markyxyz Nov 1 '17 at 4:24
  • 4
    Why, for the sake of Church of Emacs, would somebody like to have a username (or group name) with space in it? – cezar Nov 1 '17 at 7:27
  • 1
    @cezar : It's a synagogue, not a church. – user1404316 Mar 19 '18 at 10:59
7

Group and user names aren’t allowed to contain the space character on POSIX-style systems; see Command line login failed with two strings ID in Debian Stretch for references (the restrictions apply to groups as well as users).

In your case you might be able to work around the limitation by managing your groups in AD rather than in /etc/group. But I’d recommend trying to convince the powers that be to drop spaces entirely...

| improve this answer | |
2

I had a similar problem with group name "domain users" coming from AD. For chown I was able to use group id number instead of group name. For example:

sudo chown -R user1:118600513 /home/user1

where 118600513 is the id for a group "domain users".

| improve this answer | |
  • Using the GID might work for chown (since the group name doesn't really exist at that level), but I don't think this answers the question of how manage user-to-group membership with names like that. – ilkkachu Feb 6 '18 at 10:45
  • @ilkkachu, thanks! I have updated my answer. But you are right - probably it does not help OP. – djhurio Feb 6 '18 at 12:50
0

I did not try this for group but for user info that is gecos info as in usermod command add " " i.e inverted commas with space in between.

usermod username -c User" "Name
| improve this answer | |
0

I spent an entire day searching the same topic. Here's what I found and tested on Debian 9 + Samba AD DC 4.5.12

In order to set sharing folder permission, a somewhat local unix group or user must be present. Option 1: Create Group with gid I failed to map the gid after creation by net groupmap, but was able to map them at the time of creation by

groupadd localgroupnamewithoutspace
cat /etc/group
samba-tool group add "Groupname with Space" --nis-domain=mydomain --gid-number=corresponding gid we just saw in /etc/group
chgrp localgroupnamewithoutspace /path/of/share
chmod 0770 /path/of/share

Option 2: Look up gid of AD group Unix group doesn't allow space, so set group of directory to gid will work. However, when doing ls -al it will show gid number not AD group or Unix group name. This could potentially be a problem if multiple groups are nested and assigned in the same large sharing parent directory.

wbinfo --name-to-sid "AD Group name with space"
wbinfo --sid-to-gid "copy from the ouput above"

it should look like this and you only need this part S-1-5-21-53980404-2501955692-3283166571-512 then use the gid number when setting permission by chgrp, chmod.

Noted, The above only takes care of AD group and Unix group mapping, the actual ACL and group member permission still requires to have proper SeDiskOperatorPrivilege setup, and then configured through Windows Client with account has SeDiskOperatorPrivilege in File Explorer and ADUC.

edited: typo

| 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.