We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e4786f commit 525c048Copy full SHA for 525c048
lib/system/guest_agent/main.go
@@ -424,7 +424,9 @@ func (s *guestServer) CopyToGuest(stream pb.GuestService_CopyToGuestServer) erro
424
}
425
426
// Set ownership if provided (archive mode)
427
- if start.Uid > 0 || start.Gid > 0 {
+ // Only chown when both UID and GID are explicitly set (non-zero)
428
+ // to avoid accidentally setting one to root (0) when only the other is specified
429
+ if start.Uid > 0 && start.Gid > 0 {
430
if err := os.Chown(start.Path, int(start.Uid), int(start.Gid)); err != nil {
431
log.Printf("[guest-agent] warning: failed to set ownership on %s: %v", start.Path, err)
432
0 commit comments