diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 49252dcf9e2..ab05c7ca059 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -711,10 +711,9 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UR Ok(()) } -/// Handle incomplete user/group parings for chown. +/// Handle ownership changes when -o/--owner or -g/--group flags are used. /// /// Returns a Result type with the Err variant containing the error message. -/// If the user is root, revert the uid & gid /// /// # Parameters /// @@ -735,11 +734,8 @@ fn chown_optional_user_group(path: &Path, b: &Behavior) -> UResult<()> { // Determine the owner and group IDs to be used for chown. let (owner_id, group_id) = if b.owner_id.is_some() || b.group_id.is_some() { (b.owner_id, b.group_id) - } else if geteuid() == 0 { - // Special case for root user. - (Some(0), Some(0)) } else { - // No chown operation needed. + // No chown operation needed - file ownership comes from process naturally. return Ok(()); };