Is it possible to add a user to a group without usermod? I'm working on embedded Linux 3.14.52 and I don't have the usermod command line. If it is not possible, how add this command to kernel with Buildroot?
To add a user to a group, specify the -a -G flags. These should be followed by the name of the group to which you want to add a user and the user's username.
To add a member to a supplementary group, use the usermod command to list the supplementary groups that the user is currently a member of, and the supplementary groups that the user is to become a member of. where user-name is the user name. To display who is a member of a group, use the getent command.
In Buildroot, users and groups are created with the BR2_ROOTFS_USERS_TABLES
configuration option. Set it to a file or list of files or users you want to create. See section 9.6 of the Buildroot manual. Note that this only allows you to specify users; groups are created automatically when a user is assigned to a group.
Alternatively, you can take control of the entire /etc/groups file by adding a filesystem overlay.
To update the group configuration at runtime, you can use the addgroup
and delgroup
utilities in busybox.
The user<->group association is saved in the /etc/group file. Each line of the file is in the format:
group_name:password:GID:user_list
You can add users in the comma-separated user_list part. If you prefer to use some existing tool, you can consider gpasswd (if available).
I don't know how to help you for the kernel/buildroot question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With