简体   繁体   English

服务许可被拒绝 - Fedora 31

[英]Service permission denied - Fedora 31

I am currently working on a website that will run .net code using this guide:我目前正在一个网站上工作,该网站将使用本指南运行 .net 代码:

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-3.1 https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-3.1

And this guide to install .net core SDK (I installed 2.1 and 3.1 while troubleshooting):以及安装 .net core SDK 的指南(我在故障排除时安装了 2.1 和 3.1):

https://docs.microsoft.com/en-ca/dotnet/core/install/linux-package-manager-fedora31 https://docs.microsoft.com/en-ca/dotnet/core/install/linux-package-manager-fedora31

I am trying to configure the apache proxy server to send requests to the Kestrel server but I am having issues with my service at /etc/systemd/system/kestrel-helloapp.service.我正在尝试配置 apache 代理服务器以将请求发送到 Kestrel 服务器,但是我在 /etc/systemd/system/kestrel-helloapp.service 中遇到了我的服务问题。

My service's code is:我的服务代码是:

[Unit]
Description=Started service

[Service]
WorkingDirectory=/var/www/html/PublishedVersion
ExecStart=/usr/share/dotnet /var/www/html/PublishedVersion/Website.dll
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=root
Enviroment=ASPNETCORE_ENVIROMENT=Production

[Install]
WantedBy=multi-user.target

The service status is:服务状态为:

Mar 15 19:37:38 localhost.localdomain systemd[1]: Started service
Mar 15 19:37:38 localhost.localdomain systemd[1706]: kestrel-helloapp.service: Failed to execute command: Permission denied
Mar 15 19:37:38 localhost.localdomain systemd[1706]: kestrel-helloapp.service: Failed at step EXEC spawning /usr/share/dotnet: Permission denied
Mar 15 19:37:38 localhost.localdomain systemd[1]: kestrel-helloapp.service: Main process exited, code=exited, status=203/EXEC
Mar 15 19:37:38 localhost.localdomain systemd[1]: kestrel-helloapp.service: Failed with result 'exit-code'.

There are three main differences in my service code in comparison to the guides code:与指南代码相比,我的服务代码有以下三个主要区别:

1st: I have removed to auto restart, so it dosen't bog down my machine.第一:我已经取消自动重启,所以它不会让我的机器陷入困境。

2nd: I have changed the ExecStart=/usr/local/dotnet to ExectStart=/usr/shared/dotnet , I have done this because my .net installation isn't at that location for some reason that eludes me.第二:我已将ExecStart=/usr/local/dotnet更改为ExectStart=/usr/shared/dotnet ,我这样做是因为我的 .net 安装由于某种原因不在那个位置。

3rd: I have changed the User=apache to User=root in an attempt to troubleshoot, the only user on my machine is root as this machine is just for school purposes.第三:我已将User=apache更改为User=root以尝试进行故障排除,我的机器上唯一的用户是 root,因为这台机器仅用于学校用途。

I have also changed the SELinux settings on my machine to permissive and finally disabled in an attempt at troubleshooting.我还将机器上的 SELinux 设置更改为宽松,并最终禁用以尝试进行故障排除。

I'm still new to this and none of this was seen in class, so go easy on me.我还是个新手,在课堂上没有见过这些,所以放轻松。

Thanks you for your time/answers.感谢您的时间/回答。

Systemd has restrictions on where executed files are located. Systemd 对执行文件的位置有限制。 I'm not an expert in this field but there is a workaround on this issue.我不是这个领域的专家,但有一个解决这个问题的方法。 You can edit /etc/selinux/config and change line:您可以编辑/etc/selinux/config并更改行:

SELINUX=enforcing with SELINUX=permissive , SELINUX=enforcingSELINUX=permissive ,

then restart the system and the service from systemd will start.然后重新启动系统,systemd 中的服务将启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 数据库“master”中的 CREATE TABLE 权限被拒绝。 - CREATE TABLE permission denied in database 'master'. MVC出现错误-拒绝CREATE DATABASE权限 - MVC Getting Error - CREATE DATABASE permission denied 在ASP MVC中创建数据库的权限被拒绝 - Permission denied in creating a database in ASP MVC jQuery权限被拒绝-不同的域名 - Jquery permission denied - different domain name 遵循MVC 4教程时拒绝Sql权限/未安装SSDT - Denied Sql permission while following MVC 4 tutorial / SSDT not installing asp mvc 3 noobie:数据库'master'中的CREATE DATABASE权限被拒绝 - asp mvc 3 noobie: CREATE DATABASE permission denied in database 'master' CREATE DATABASE权限在数据库“ master”中被拒绝。 MVC 4应用程序中的错误 - CREATE DATABASE permission denied in database 'master'. error in MVC 4 application CREATE DATABASE权限在数据库“ master”中被拒绝。 发布到Web服务器时 - CREATE DATABASE permission denied in database 'master'. when publishing to web server MVC 5 应用程序连接到 SQL Server:选择权限被拒绝 - MVC 5 Application connecting to SQL Server : Select permission denied 实体框架MigrateDatabaseToLatestVersion在数据库“master”错误中拒绝CREATE DATABASE权限 - Entity Framework MigrateDatabaseToLatestVersion CREATE DATABASE permission denied in database 'master' error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM