Skip to content

Commit

Permalink
Fix nfs permissions (#20113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Furisto authored Aug 13, 2024
1 parent 4524c19 commit cd00bab
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions components/ws-daemon/pkg/iws/iws.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,23 @@ func (wbs *InWorkspaceServiceServer) MountNfs(ctx context.Context, req *api.Moun
return nil, xerrors.Errorf("cannot mount nfs: %w", err)
}

stat, err := os.Stat(nodeStaging)
if err != nil {
return nil, xerrors.Errorf("cannot stat staging: %w", err)
}

sys, ok := stat.Sys().(*syscall.Stat_t)
if !ok {
return nil, xerrors.Errorf("cast to stat failed")
}

if sys.Uid != 133332 || sys.Gid != 133332 {
err = os.Chown(nodeStaging, 133332, 133332)
if err != nil {
return nil, xerrors.Errorf("cannot chown %s for %s", nodeStaging, req.Source)
}
}

err = moveMount(wbs.Session.InstanceID, int(nfsPID), nodeStaging, req.Target)
if err != nil {
return nil, err
Expand Down

0 comments on commit cd00bab

Please sign in to comment.