We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c6d89a commit 0f4980cCopy full SHA for 0f4980c
utils/file.go
@@ -24,6 +24,7 @@ import (
24
"strings"
25
26
"github.com/steiler/acls"
27
+ "golang.org/x/sys/unix"
28
29
log "github.com/sirupsen/logrus"
30
)
@@ -196,6 +197,16 @@ func CreateFile(file, content string) (err error) {
196
197
return err
198
}
199
200
+ // Change file ownership to user running Containerlab instead of effective UID
201
+ realUID, effUID, _ := unix.Getresuid()
202
+ if realUID != effUID {
203
+ realGID, _, _ := unix.Getresgid()
204
+ err = os.Chown(file, realUID, realGID)
205
+ if err != nil {
206
+ return err
207
+ }
208
209
+
210
return f.Close()
211
212
0 commit comments