sdk: "dotnet" commands have permission issues
Steps to reproduce
run dotnet clean, dotnet restore, dotnet build, or dotnet publish
Expected behavior
The command should complete without error
Actual behavior
Here is the error:
$ dotnet clean
Configuring…
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once. Decompressing 100% 6734 ms System.AggregateException: One or more errors occurred. (One or more errors occurred. (Access to the path ‘/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.entityframeworkcore.tools/2.1.1/microsoft.entityframeworkcore.tools.nuspec’ is denied.))
Environment data
dotnet --info output:
.NET Core SDK (reflecting any global.json): Version: 2.1.302 Commit: 9048955601
Runtime Environment: OS Name: Mac OS X OS Version: 10.13 OS Platform: Darwin RID: osx.10.13-x64 Base Path: /usr/local/share/dotnet/sdk/2.1.302/
Host (useful for support): Version: 2.1.2 Commit: 811c3ce6c0
.NET Core SDKs installed: 2.1.4 [/usr/local/share/dotnet/sdk] 2.1.300-preview2-008533 [/usr/local/share/dotnet/sdk] 2.1.300 [/usr/local/share/dotnet/sdk] 2.1.301 [/usr/local/share/dotnet/sdk] 2.1.302 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0-preview1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.0-preview2-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.0-preview1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.0-preview2-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0-preview1-26216-03 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0-preview2-26406-04 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 7
- Comments: 28
If you follow the advice and run build as root using sudo once then your obj/bin folders will be owned by root and your normal build will fail.
Please fix this properly, building should never!!! ever require admin rights, this is so very, very, very wrong.
This cache should be in a location and with permissions that non sudo users can access.
Same issue on Windows10 with .NET Core 2.2.104. I deleted the
NuGetFallbackFolderthen went to Windows Add/Remove Programs and clicked repair it. Well, it somehow is repaired. I checked theC:\Program Files\dotnet\sdkand theNuGetFallbackFolderis back with no error on each run now.@HusseinElGanzory Thanks, however for the developers, it is extremely wrong that this is necessary, 777 is a extreme nuke it from orbit approach with very serious security implications.
There is no world in which it is OK for a build to by default require root access, ever, this should be a very high priority fix, the fact this issue still persists after 11 months is very concerning.
i give all permissions to a folder /usr/share/dotnet/sdk/NuGetFallbackFolder
sudo chmod -R 777 /usr/share/dotnet/sdk/NuGetFallbackFolderthen build project i worked very wellThis worked for me, the problem started after the update to dotnet core 2.2. I’m using Windows 10.
I’m facing the same error on ubuntu updating to apt-git. I renamed the folder to NuGetfallbackFolder.bak, and the SDK still complains about it but allows me to continue
On Windows, changing permissions on
C:\Program Files\dotnet\sdk\NuGetFallbackFolderworked for me (Properties -> Security -> Edit… -> Full Control for Administrators and Users).I received this error because I set my Environment to production (to try fix another issue). The below fixed it for me
On Linux
export ASPNETCORE_ENVIRONMENT=DevelopmentMacOS and Windows see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1
Looks like deleting the “NuGetFallbackFolder” fixed the issue. Any idea what the problem was?