Failed to execute command: Permission denied

2020-12-18  乐帮网

service centos

在上CentOS写了一个服务,使用命令systemctl start  servicename 启动服务时,遇到如下错误:

Job for vktdemo.service failed because the control process exited with error code.
See "systemctl status vktdemo.service" and "journalctl -xe" for details.

使用命令查看日志如下:

[root@test system]# journalctl -xe

查询结果如下:

-- Automatic restarting of the unit vktdemo.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Dec 17 08:37:16 test systemd[1]: Stopped vkt demo service.
-- Subject: Unit vktdemo.service has finished shutting down
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit vktdemo.service has finished shutting down.
Dec 17 08:37:16 test systemd[1]: Starting vkt demo service...
-- Subject: Unit vktdemo.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit vktdemo.service has begun starting up.
Dec 17 08:37:16 test systemd[3845412]: vktdemo.service: Failed to execute command: Permission denied
Dec 17 08:37:16 test systemd[3845412]: vktdemo.service: Failed at step EXEC spawning /homektservice/demokt.demo.workerservice.dll: Permission deni>
-- Subject: Process /homektservice/demokt.demo.workerservice.dll could not be executed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- The process /homektservice/demokt.demo.workerservice.dll could not be executed and failed.
-- 
-- The error number returned by this process is 13.
Dec 17 08:37:16 test systemd[1]: vktdemo.service: Main process exited, code=exited, status=203/EXEC
Dec 17 08:37:16 test systemd[1]: vktdemo.service: Failed with result 'exit-code'.
Dec 17 08:37:16 test systemd[1]: Failed to start vkt demo service.
-- Subject: Unit vktdemo.service has failed

这个错误引起的原因也是简单,就是我们上传的这个文件 /home/vktservice/demokt.demo.workerservice.dll 使用systemd 账号无执行权限。解决办法如下:

[root@vkt01 myadmin]# chmod -R 775 /home/vktservice/demo/

把执行权限下放到相关用户。现在再试一下是不是解决你的问题了?

相关链接:NetCore 开发服务 (Windows Linux) 

部署过程详情:Linux 部署NetCore服务

相关链接:Process could not be executed Exec format error 
l

原创禁止转载!

公众号二维码

关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com

庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。

欧阳修

付款二维码

如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力