Bug 14431 - adduser will add a user folder with 'shadow_t'
Summary: adduser will add a user folder with 'shadow_t'
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-07 07:30 UTC by 15256067679
Modified: 2021-12-07 07:30 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 15256067679 2021-12-07 07:30:31 UTC
I compile the busybox with SELinux support(I tried both with 1.33.x and 1.34.1), then I try to use adduser to create a new user:

# adduser user_1
Changing password for user_1
New password:
Bad password: too weak
Retype password:
Passwords don't match
passwd: password for user_1 is unchanged
# cd /home/
# ls -Z
system_u:object_r:user_home_dir_t:s0 default
system_u:object_r:shadow_t:s0    user_1

and I check the source code in adduser.c:

the function 'selinux_preserve_fcontext(old_fd)'in 'update_passwd(bb_path_shadow_file, pw.pw_name, p, NULL);' will change the filecontext for the file that adduser make to 'shadow_t' and I can't find where to change it back.