Reputation: 435
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?
Upvotes: 6
Views: 13460
Reputation: 1
Also, you can create groups by assigning them to that user at first with -G option.
sudo useradd -G group1,group2 username1
You can check the user groups by typing
id username1
output :
uid=1000(username1) gid=1002(username1) groups=1002(username1),1000(group1),1001(group2)
Upvotes: 0
Reputation: 3464
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.
Upvotes: 2
Reputation: 1021
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.
Upvotes: 2