Question

  • Creator
    Topic
  • #2144674

    Remove A User From the specific Group In Linux

    by samueltarcin9999 ·

    How can I remove a specific user from the group?

You are posting a reply to: Remove A User From the specific Group In Linux

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

  • Author
    Replies
    • #2416794

      How can I remove a specific user from the group?

      by rvkanth1996 ·

      In reply to Remove A User From the specific Group In Linux

      Use usermod to remove users from the group

      We can use the usermod command to exclude a user from one or more groups at a time. When using usermod, you must specify which auxiliary groups you want to keep the user in. Let me illustrate with an example.

      $ group test users
      testuser: testuser testgroup1 testgroup2 root

      To remove the user “testuser” from the “testgroup1” and “testgroup2” groups, run the following command (that is, just keep testuser in the “root” group, which is the main “testuser” group):

      $ sudo usermod -G root testuser

      result
      $ group test users
      testuser: testuser root directory

Viewing 0 reply threads