Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

busybox: update login utils capabilities #208

Merged

Conversation

nemith
Copy link
Contributor

@nemith nemith commented Jul 23, 2024

When trying to automate user mangement on my tp2 bmc interfaces i found a lack of a couple functionalities that would make things much easier and less error prone.

The first is the CONFIG_CHPASSWD=y busybox config which add the chpasswd utility which allows changing user password from scripts much better than just passwd.

The other is CONFIG_FEATURE_ADDUSER_TO_GROUP busybox config option to update group memebership with the command adduser <user> <group>.

Also added the CONFIG_FEATURE_DEL_USER_FROM_GROUP option just as additional benefit, but not needed for my purposes.

Image size comparison

Before (master build)

vscode ➜ /src/buildroot (master) $ ls -l output/images/{tp2-bmc-firmware-sdcard.img,rootfs.erofs}
-rw-r--r--. 1 vscode vscode 37396480 Jul 23 18:25 output/images/rootfs.erofs
-rw-r--r--. 1 vscode vscode 55222272 Jul 23 18:27 output/images/tp2-bmc-firmware-sdcard.img

This branch

vscode ➜ /src/buildroot (nemith/busybox_login_utils) $ ls -l output/images/{tp2-bmc-firmware-sdcard.img,rootfs.erofs}
-rw-r--r--. 1 vscode vscode 37396480 Jul 23 18:31 output/images/rootfs.erofs
-rw-r--r--. 1 vscode vscode 55222272 Jul 23 18:32 output/images/tp2-bmc-firmware-sdcard.img

Seems to be identical but I am unfamiliar how these are packed. If there is a better way at judging the rom space increase please let me know.

Testing

# adduser bbennett wheel
# cat /etc/group | grep wheel
wheel:x:10:root,bbennett
# chpasswd --help
BusyBox v1.36.1 (2024-07-23 18:29:15 UTC) multi-call binary.

Usage: chpasswd [-me] [-c ALG] [-R DIR]

Read user:password from stdin and update /etc/passwd

	-e	Supplied passwords are in encrypted form
	-m	Encrypt using md5, not des
	-c ALG	des,md5,sha256/512 (default md5)
	-R DIR	Directory to chroot into
# chpasswd
bbennett:foo
chpasswd: password for 'bbennett' changed

@nemith nemith marked this pull request as ready for review July 23, 2024 18:45
Copy link
Collaborator

@svenrademakers svenrademakers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strange that the images sizes are identical, my assumption is a issue with retriggering certain components. It would not be the first time. anyway, i approve

@svenrademakers svenrademakers merged commit 95c85f1 into turing-machines:master Jul 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants