From the error message, you may still have at least one user account associated with the group. From the "Caveats" section of the documentation:
You may not remove the primary group of any existing user. You must remove the user
before you remove the group.
You should manually check all file systems to ensure that no files remain owned by
this group.
With this in mind, you can see which users are associated with the sambashare
group in Terminal like this:
getent group sambashare
This may give you something like this:
sambashare:x:1001:samba,alec
Note: In this example, sambashare
is the group name, 1001
is the gid
(group ID) value, and samba,alec
are the user accounts associated with the group.
You can remove the user accounts from the group like this:
sudo deluser {username} sambashare
Note: Be sure to replace {username}
with the actual user name that you are removing from the group. While deluser
may infer you are deleting a user account, it will simply remove a user account from a group.
If the user is only part of sambashare
, then you will probably want to remove the user completely:
sudo deluser {username}
Note: If the user account has a home directory and you would like it removed at the same time, you can add --remove-home
between deluser
and the {username}
.
Once the group has no accounts associated with it, you can remove the group completely:
sudo groupdel sambashare
Note: Technically you can run this so long as no user account has sambashare
as their primary group, but you may want to remove all accounts first, just to be safe.
This should do what you are hoping to accomplish