Bug 15799 - Add default non-root user (e.g. "admin")
Summary: Add default non-root user (e.g. "admin")
Status: NEW
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 5.3
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 6.1 M2
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-03-17 17:39 UTC by Tim Orling
Modified: 2026-05-28 13:17 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Yes (doc changes required)


Attachments
admin-user_1.0.bb: an example "admin" user with "sudo" privileges (1.46 KB, text/plain)
2025-03-17 17:39 UTC, Tim Orling
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Orling 2025-03-17 17:39:46 UTC
Created attachment 5107 [details]
admin-user_1.0.bb: an example "admin" user with "sudo" privileges

For a more secure baseline, we should really not be logging in as root at all. Instead, we should use a non-root user with 'sudo' privileges. I have attached a stripped down version of recipe that I use.
Comment 1 Randy MacLeod 2025-03-20 14:38:04 UTC
Currently tied to systemd and has some other minor issues.
We may also want to run the ptest as the admin user so there's more work to do.
Comment 2 Tim Orling 2025-03-20 14:42:42 UTC
Generally, sudo with no password is also considered a security flaw, so ptest would need to use a default password.

The systemd-journal group allows you to see dmesg and journald without using sudo, but needs to be gated on whether 'systemd' is in DISTRO_FEATURES.

In practice, we are also using user-staticids, but I am not sure that should be added to a base image (you provide /etc/passwd and /etc/group to ensure all uid and gid are static/known).
Comment 3 Tim Orling 2025-03-20 14:56:52 UTC
sudo with no password, but limited access to commands could be an option for ptest. We could have a dedicated ptest user.

Concept (/etc/sudoers.d/ptest):

# Add commands that the 'ptest' user is allowed to run without a sudo password
Cmnd_Alias PTEST_CMDS=/some/restricted/command /some/other/resistricted/command

%ptest ALL=(ALL:ALL) NOPASSWORD: PTEST_CMDS
Comment 4 Ross Burton 2025-03-20 15:00:47 UTC
The ptest-runner recipe already has a user for ptests, we "just" need to use it in oeqa.
Comment 5 Randy MacLeod 2026-05-28 13:17:57 UTC
Bulk move of unassigned 6.0-M* bugs to 6.1-M2.