Score:0

GroupDel Samba Share doesn't work

cn flag

i tried deleting sambashare group with the following command groupdel sambashare

and i later got Permission denied and cannot lock /etc/group; try again later can someone help me?

hr flag
The command would need to be run as root (using `sudo` for example) - did you do so?
cn flag
i run as root by using sudo again, got sudo and still got permission denied
cn flag
excuse me, but is there a way to lsit all users in samba share and remove them with terminal?
Satoshi Nakamoto avatar
lc flag
it's crucial that you share with us your input and output commands
Score:0
in flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.