Skip to content

Commit cd00bab

Browse files
authored
Fix nfs permissions (#20113)
1 parent 4524c19 commit cd00bab

File tree

1 file changed

+17
-0
lines changed
  • components/ws-daemon/pkg/iws

1 file changed

+17
-0
lines changed

components/ws-daemon/pkg/iws/iws.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,23 @@ func (wbs *InWorkspaceServiceServer) MountNfs(ctx context.Context, req *api.Moun
757757
return nil, xerrors.Errorf("cannot mount nfs: %w", err)
758758
}
759759

760+
stat, err := os.Stat(nodeStaging)
761+
if err != nil {
762+
return nil, xerrors.Errorf("cannot stat staging: %w", err)
763+
}
764+
765+
sys, ok := stat.Sys().(*syscall.Stat_t)
766+
if !ok {
767+
return nil, xerrors.Errorf("cast to stat failed")
768+
}
769+
770+
if sys.Uid != 133332 || sys.Gid != 133332 {
771+
err = os.Chown(nodeStaging, 133332, 133332)
772+
if err != nil {
773+
return nil, xerrors.Errorf("cannot chown %s for %s", nodeStaging, req.Source)
774+
}
775+
}
776+
760777
err = moveMount(wbs.Session.InstanceID, int(nfsPID), nodeStaging, req.Target)
761778
if err != nil {
762779
return nil, err

0 commit comments

Comments
 (0)