I am currently attempting to run a .NET 5.0 ASP.NET application on a Amazon Linux 2 EC2 instance.
This is being hosted with nginx, automatically run with supervisord upon deployment. This is my first time running this after deploying and found this error stack trace from the supervisor stderr for this application.
System.UnauthorizedAccessException: Access to the path '/root/.dotnet' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at System.IO.FileSystem.CreateDirectory(String fullPath)
at System.IO.Directory.CreateDirectory(String path)
at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateDirectory(String path)
at Microsoft.DotNet.Configurer.FileSystemExtensions.<>c__DisplayClass0_0.<CreateIfNotExists>b__0()
at Microsoft.DotNet.Cli.Utils.FileAccessRetrier.RetryOnIOException(Action action)
at Microsoft.DotNet.Configurer.FileSystemExtensions.CreateIfNotExists(IFileSystem fileSystem, String filePath)
at Microsoft.DotNet.Configurer.FileSentinel.Create()
at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel, IAspNetCertificateSentinel aspNetCertificateSentinel, IFileSentinel toolPathSentinel, Boolean isDotnetBeingInvokedFromNativeInstaller, DotnetFirstRunConfiguration dotnetFirstRunConfiguration, IEnvironmentProvider environmentProvider, Dictionary`2 performanceMeasurements)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
I am curious as to why this is targeting root to create a directory AND is giving permissions to root the solution to this OR is it something else? From my searching this doesn't seem to have happened to anyone else. I'm just very cautious in blatantly giving open permissions to the root folder, if that is even the solution here.
For reference, this is the tutorial I am following to set this up: https://docs.servicestack.net/deploy-netcore-to-amazon-linux-2-ami#