totn Linux

Linux: How to Remove a Group in Ubuntu Linux Server 14.04 LTS

In this Linux system administration tutorial you will learn how to remove a group on an Ubuntu Linux Server 14.04 LTS (Trusty Tahr) system with screenshots and instructions.

Description

Groups allow system administrators to apply certain permissions or access to groups of users. It is sometimes necessary to remove a group from a system when it is no longer needed.

Before a group can be removed, any users assigned to the group should be reassigned to another group. To remove a group, you will use the groupdel command.

Syntax

The syntax for the groupdel command is:

groupdel Group_Name

Parameters or Arguments

The groupdel command requires the following parameter:

Group_Name
The name of the group you would like to remove. Group names should be entered in lowercase and may contain underscores.

Prerequisites

To complete this tutorial you will require a running Ubuntu Linux Server 14.04 LTS system and an account with sudo administrative privileges. The sudo command is used to provide the superuser privileges required for the groupdel command.

Remove a Group

The following steps will guide you through removing a group on an Ubuntu Linux Server 14.04 LTS system.

IMPORTANT: Certain pre-installed groups are required for the system to operate properly. Do NOT remove a group from a system unless you are sure it is not needed!
  1. To remove an existing group from your system, you will need to be logged in using a valid user account. If you are unsure of how to do this, read our tutorial on Logging into Ubuntu Linux Server 14.04 LTS.

    In this tutorial, we have logged in as techonthenet on the host called ubuntu.

  2. Now that we're logged in, we can remove the group with a Group Name of students by entering the following groupdel command:

    sudo groupdel students

    This screenshot demonstrates what you will see.

    Remove group

    When you have typed in the command, press the Enter key to execute the command.

  3. The sudo command will now prompt you to enter the password for your administrator account.

    Enter sudo password

    Please note that no characters will show as you type your password. This is normal and is important to preserve the security of your password.

    After you have entered your password, press the Enter key to continue.

  4. If all goes well, you will see the system prompt appear again without any errors. This indicates that the group called students has been successfully removed.

    After group removed

  5. This step and step #6 are optional.

    In this step we will check to ensure that the group called students was removed from the system by using the grep command to search the system /etc/group file for the students group. If the students group is not found then we have confirmed that the group has been removed.

    Enter the following grep command after the system prompt to search the system group file:

    sudo grep students /etc/group

    The following screenshot demonstrates what the command will look like after it is typed.

    Grep group file

    When you have typed the command, press the Enter key to execute the command.

  6. As seen in the screenshot below, the students group was not found by the grep command confirming that we have removed the students group from the system.

    Confirm group removed

    Congratulations, you have successfully removed a group from your Ubuntu Linux Server 14.04 LTS system!