- Как удалить группу в Linux (команда groupdel)
- Синтаксис команды groupdel
- Удаление группы в Linux
- Выводы
- Delete Groups in Linux With groupdel Command
- Using groupdel command in Linux
- Keep in mind: You cannot delete primary group of a user without deleting the user
- Keep in mind: Files belonging to the deleted group will not change group ownership
- Linux: How to Remove a Group in Ubuntu Linux Server 16.04 LTS
- Description
- Syntax
- Parameters or Arguments
- Prerequisites
- Remove a Group
- Удаление групп в Linux с помощью команды groupdel
- Использование команды groupdel в Linux
- Имейте в виду: вы не можете удалить основную группу пользователя без удаления пользователя
- Помните: файлы, принадлежащие удаленной группе, не изменят владельца группы.
- How to Delete Volume Group(LVM) in Linux Using 5 Easy Steps
- Delete Volume Group(LVM) in Linux
- 1. Check mounted Logical Volume using df command
- 2. Unmount the Volume using umount command
- 3. Disable Logical Volume using lvchange command
- 4. Delete Logical Volume using lvremove command
- 5. Delete Volume Group using vgremove command
Как удалить группу в Linux (команда groupdel)
В Linux группы используются для организации и администрирования учетных записей пользователей. Основная цель групп — определить набор привилегий, таких как разрешение на чтение, запись или выполнение для данного ресурса, которые могут быть совместно использованы пользователями внутри группы.
Новую группу можно создать с помощью команды groupadd . Если группа больше не нужна и ее можно удалить из системы.
В этой статье объясняется, как удалить группу в Linux с помощью команды groupdel .
Синтаксис команды groupdel
Общий синтаксис команды groupdel следующий:
GROUPNAME — это имя группы, которую вы хотите удалить.
Только root или пользователь с привилегиями sudo могут удалять группы.
Невозможно удалить основную группу существующего пользователя без предварительного удаления пользователя.
Команда groupdel принимает только несколько параметров, которые используются редко. См. groupdel страницу groupdel для получения дополнительной информации о параметрах команды.
Удаление группы в Linux
Чтобы удалить (удалить) данную группу из системы, вызовите команду groupdel за которой следует имя группы.
Например, чтобы удалить группу с именем mygroup вы должны запустить:
Приведенная выше команда удаляет запись о группе из файлов /etc/group и /etc/gshadow .
В случае успеха команда groupdel не выводит никаких результатов.
Вы можете убедиться, что группа удалена, перечислив все группы с помощью следующей команды:
Если группа, которую вы хотите удалить, не существует, система выведет сообщение об ошибке следующего вида:
Выводы
В Linux вы можете удалять группы с помощью команды groupdel .
Те же инструкции применимы для любого дистрибутива Linux, включая Ubuntu, CentOS, RHEL, Debian, Fedora и Arch Linux.
Не стесняйтесь оставлять комментарии, если у вас есть вопросы.
Источник
Delete Groups in Linux With groupdel Command
In an earlier article, I discussed the groupadd command which is used for adding new groups to your Linux system.
In this article, I’ll discuss another group management command which is groupdel. It is used for deleting groups from your system.
Using groupdel command in Linux
The groupdel command is perhaps the simplest command in Linux with virtually no options (other than one for chroot).
All you have to do is to specify the group name. The group must exist, of course.
Did you notice that I used sudo with the groupdel command? It’s because it is an administrative command and you need to be root or sudo user to run this command.
How do you get the group name? You can list groups for a user or manually check all the groups present in your system by viewing the content of file /etc/group.
Keep in mind: You cannot delete primary group of a user without deleting the user
If you try to remove the primary group of an existing user, you should see an error like this:
groupdel: cannot remove the primary group of user ‘abhishek’
This is by design. You cannot delete the primary group of an existing user. You have two options here:
- Change the primary group of a user using usermod command
- Delete the user using userdel command and then delete the group
Keep in mind: Files belonging to the deleted group will not change group ownership
The groupdel command doesn’t change the group ownership of any files. It simply removes the group name from the system. If you list files owned by a deleted group, you’ll see the group id (GID) instead of group name.
I hope you are aware of the file permission and ownership concept in Linux. As you can see below, the file belongs to group tesla:
Once I delete the group, the file shows the group ID (998 in the example) instead of the group name:
What do you do with such files, then? It’s up to you really. You can leave it like that or use a combination of find, xargs and chgrp command to change the group of files belonging to the GID of the deleted group like this:
Since we are speaking of file permissions and ownership, you might want to know about the stat command that can display these information in detail.
I hope this tutorial gave you a better understanding of the groupdel command in Linux. If you have any questions or suggestions, please let me know in the comments.
Источник
Linux: How to Remove a Group in Ubuntu Linux Server 16.04 LTS
In this Linux system administration tutorial you will learn how to remove a group on an Ubuntu Linux Server 16.04 LTS (Xenial Xerus) 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:
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 16.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 16.04 LTS system.
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 16.04 LTS.
In this tutorial, we have logged in as techonthenet on the host called ubuntu.
Now that we’re logged in, we can remove the group with a Group Name of professors by entering the following groupdel command:
This screenshot demonstrates what you will see.
When you have typed in the command, press the Enter key to execute the command.
The sudo command will now prompt you to enter the password for your administrator account.
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.
If all goes well, you will see the system prompt appear again without any errors. This indicates that the group called professors has been successfully removed.
This step and step #6 are optional.
In this step we will check to ensure that the group called professors was removed from the system by using the grep command to search the system /etc/group file for the professors group. If the professors 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:
The following screenshot demonstrates what the command will look like after it is typed.
When you have typed the command, press the Enter key to execute the command.
As seen in the screenshot below, the professors group was not found by the grep command confirming that we have removed the professors group from the system.
Congratulations, you have successfully removed a group from your Ubuntu Linux Server 16.04 LTS system!
Источник
Удаление групп в Linux с помощью команды groupdel
Главное меню » Linux » Удаление групп в Linux с помощью команды groupdel
Использование команды groupdel в Linux
Команда groupdel, пожалуй, самая простая в Linux, практически без параметров (кроме команды для chroot).
Все, что вам нужно сделать, это указать название группы. Группа должна существовать, конечно.
Вы заметили, что мы использовали sudo с командой groupdel? Это потому, что это административная команда, и для запуска этой команды вам нужно быть пользователем root или sudo.
Как вы получаете название группы? Вы можете составить список групп для пользователя или вручную проверить все группы, присутствующие в вашей системе, просмотрев содержимое файла /etc/group.
Имейте в виду: вы не можете удалить основную группу пользователя без удаления пользователя
Если вы попытаетесь удалить основную группу существующего пользователя, вы должны увидеть такую ошибку:
groupdel: cannot remove the primary group of user ‘andreyex’
Вы не можете удалить основную группу существующего пользователя. У вас есть два варианта здесь:
- Измените основную группу пользователя с помощью команды usermod
- Удалите пользователя с помощью команды userdel, а затем удалите группу
Помните: файлы, принадлежащие удаленной группе, не изменят владельца группы.
Команда groupdel не меняет владельца группы для каких-либо файлов. Он просто удаляет имя группы из системы. Если вы перечислите файлы, принадлежащие удаленной группе, вы увидите идентификатор группы (GID) вместо имени группы.
Мы надеемся, что вы знаете о концепции разрешения и владения файлами в Linux. Как вы можете видеть ниже, файл принадлежит группе terminator:
Как только мы удалим группу, файл показывает идентификатор группы (в примере 998) вместо имени группы:
Что вы делаете с такими файлами, тогда? Это зависит от вас на самом деле. Вы можете оставить это так или использовать комбинацию команд find, xargs и chgrp, чтобы изменить группу файлов, принадлежащих GID удаленной группы, следующим образом:
Поскольку мы говорим о правах доступа к файлам и владении ими, вам может потребоваться информация о команде stat, которая может отображать эту информацию в деталях.
Мы надеемся что эта статья дала вам лучшее понимание команды groupdel в Linux. Если у вас есть какие-либо вопросы или предложения, пожалуйста, дайте нам знать в комментариях.
Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.
Источник
How to Delete Volume Group(LVM) in Linux Using 5 Easy Steps
Table of Contents
In this article, I will take you through the steps to delete Volume Group in Linux. Volume group is a logical aggregation of physical volumes in LVM(Logical Volume Manager) Technology. This acts as a storage reservoir in LVM where the storage can be added by adding multiple physical volumes and it can be assigned as well by creating multiple logical volumes. Volume Group provides an abstraction Layer in LVM which allows us to manage the free spaces of multiple storage disks in an effective manner.
Delete Volume Group(LVM) in Linux
1. Check mounted Logical Volume using df command
First you need to check the mounted volume and the mount point name using df -h command. Here you can see that log_grp1 is currently mounted on /u01 mount point. To know more about LVM configuration you can check on How to configure LVM (pvcreate, vgcreate and lvcreate ) in Linux Using 6 Easy Steps.
2. Unmount the Volume using umount command
Once you identified the mount point, you need to remove it by using umount /u01 command as shown below.
After unmounting the logical volume you can further check if there are any other active logical volumes of volume group vol_grp1 is currently mounted.
Once everything is verified, you can safely remove any entry from /etc/fstab if available. This will make sure that System will not try to mount something which is unavailable.
3. Disable Logical Volume using lvchange command
Now to we need to disable all the associated logical volume before moving ahead and delete volume group from the System. You can disable the logical volume log_grp1 by using lvchange -an /dev/vol_grp/log_grp1 command as shown below.
Check Logical Volume status using lvscan command. You can check from below output log_grp1 is now showing in inactive state. Similarly you need to disable all the logical volume associated with Volume Group vol_grp using lvchange command as shown above.
4. Delete Logical Volume using lvremove command
Now delete the logical volume log_grp1 using lvremove /dev/vol_grp/log_grp1 command as shown below. Similarly delete all the logical volume that is associated with Volume group vol_grp using lvremove command.
Check Logical Volume Status again by running lvscan command. You can see from below output log_grp1 does not exists now and hence it is removed.
5. Delete Volume Group using vgremove command
Once all the Logical Volume are deleted you can now delete volume Group vol_grp using vgremove vol_grp command as shown below.
To verify you can run vgscan and get confirmed if vol_grp is removed or not. As you can see from below output vol_grp does not exists now.
Popular Recommendations:-
Источник