Skip to content

Commit 5fe8deb

Browse files
authored
Add SeCreateSymbolicLinkPrivilege (#4649)
1 parent 79ff5f7 commit 5fe8deb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/pkg/agent/install/user_windows.go

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const (
3939
USER_UF_SCRIPT = 1
4040
USER_UF_NORMAL_ACCOUNT = 512
4141
USER_UF_DONT_EXPIRE_PASSWD = 65536
42+
43+
accountRightCreateSymbolicLink gowin32.AccountRightName = "SeCreateSymbolicLinkPrivilege"
4244
)
4345

4446
// FindGID returns the group's GID on the machine.
@@ -151,6 +153,10 @@ func CreateUser(name string, _ string) (string, error) {
151153
if err != nil {
152154
return "", fmt.Errorf("failed to set service logon: %w", err)
153155
}
156+
err = sp.AddAccountRight(sid, accountRightCreateSymbolicLink)
157+
if err != nil {
158+
return "", fmt.Errorf("failed to add right to create symbolic link: %w", err)
159+
}
154160

155161
return FindUID(name)
156162
}

0 commit comments

Comments
 (0)