Pkg can not create Manifest.toml as "nt authority\system" user account on Windows

Hi All :slight_smile:

I run into a very wired error. It only happens while using Julia as system-user on Windows.

Let me explain what I’m doing:
1.) Created an project with the following structure:
/my_project
/my_project/start.jl
/my_project/Project.toml
/my_project/src/MyProject.jl

The following lines are in start.jl:

using Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()

2.) Start Julia REPL as “nt authority\system”:
Here I use “PSTools”.

cmd> PsExec64.exe -s -i julia

Now I can see if I’m “nt authority\system”

julia>;
shell> whoami
nt authority\system

3.) Include the start.jl file:
After that the following error occurs

ERROR: LoadError: SystemError: opening file "my_project\\Project.toml": Permission denied
Stacktrace:
 [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
   @ Base .\error.jl:168
 [2] #systemerror#62
   @ .\error.jl:167 [inlined]
 [3] systemerror
   @ .\error.jl:167 [inlined]
 [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Bool, append::Nothing)
   @ Base .\iostream.jl:293
 [5] open(fname::String, mode::String; lock::Bool)
   @ Base .\iostream.jl:355
 [6] open(fname::String, mode::String)
   @ Base .\iostream.jl:355
 [7] open(::Base.var"#322#323"{String, Tuple{}}, ::String, ::Vararg{String, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Base .\io.jl:328
 [8] open
   @ .\io.jl:328 [inlined]
 [9] write
   @ .\io.jl:420 [inlined]
[10] write_project
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\project.jl:178 [inlined]
[11] write_project
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\project.jl:169 [inlined]
[12] write_project(env::Pkg.Types.EnvCache)
   @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\project.jl:167
[13] #write_env#106
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:1399 [inlined]
[14] write_env
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:1399 [inlined]
[15] up(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, level::Pkg.Types.UpgradeLevel)
   @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1320
[16] up(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; level::Pkg.Types.UpgradeLevel, mode::Pkg.Types.PackageMode, update_registry::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:254
[17] #up#39
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:77 [inlined]
[18] instantiate(ctx::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Base.BinaryPlatforms.Platform, allow_autoprecomp::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1291
[19] instantiate
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1276 [inlined]
[20] #instantiate#246
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1272 [inlined]
[21] instantiate()
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1272
[22] top-level scope
   @ my_project\start.jl:4
n expression starting at my_project\start.jl:4

Can anybody reproduce that error? How can I fix it?

The file I’m trying to touch was on a network drive and I had no permission…