首页 > 其他分享 >httpd.service: Failed at step EXEC spawning usrsbinhttpd: Permission denied

httpd.service: Failed at step EXEC spawning usrsbinhttpd: Permission denied

时间:2024-12-14 17:32:14浏览次数:5  
标签:httpd service EXEC -- 62 root localhost 2.4

httpd.service: Failed at step EXEC spawning usrsbinhttpd: Permission denied

apache 编译安装之后,通过 apachectl start 可以正常启动,注册为 systemd 服务时启动不了:

[root@localhost httpd-2.4.62]# systemctl start httpd.service 
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# journalctl -xe
-- 
-- The unit dnf-makecache.service has successfully entered the 'dead' state.
Dec 14 09:24:29 localhost.localdomain systemd[1]: Started dnf makecache.
-- Subject: Unit dnf-makecache.service has finished start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit dnf-makecache.service has finished starting up.
-- 
-- The start-up result is done.
Dec 14 09:26:37 localhost.localdomain systemd[1]: Reloading.
Dec 14 09:26:44 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has begun starting up.
Dec 14 09:26:44 localhost.localdomain systemd[58017]: httpd.service: Failed to execute command: Permission denied
Dec 14 09:26:44 localhost.localdomain systemd[58017]: httpd.service: Failed at step EXEC spawning /usr/sbin/httpd: Permission denied
-- Subject: Process /usr/sbin/httpd could not be executed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /usr/sbin/httpd could not be executed and failed.
-- 
-- The error number returned by this process is 13.
Dec 14 09:26:44 localhost.localdomain systemd[1]: httpd.service: Main process exited, code=exited, status=203/EXEC
Dec 14 09:26:44 localhost.localdomain systemd[1]: httpd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The unit httpd.service has entered the 'failed' state with result 'exit-code'.
Dec 14 09:26:44 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has failed.

尝试把 SELinux 临时停用,此时通过 systemctl 可以启动 httpd 服务:

[root@localhost httpd-2.4.62]# getenforce
Enforcing
[root@localhost httpd-2.4.62]# setenforce 0
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# systemctl start httpd
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# ps -ef|grep httpd
root       58174       1  0 09:32 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
daemon     58175   58174  0 09:32 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
daemon     58176   58174  0 09:32 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
daemon     58177   58174  0 09:32 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root       58260    1761  0 09:32 pts/0    00:00:00 grep --color=auto httpd
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# systemctl stop httpd
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# ps -ef|grep httpd
root       58265    1761  0 09:34 pts/0    00:00:00 grep --color=auto httpd
[root@localhost httpd-2.4.62]# 

查看 /usr/sbin/httpd​ 文件的安全上下文类型:

/usr/sbin/httpd​ 是由 /www/server/apache2/bin/httpd 软链接过来的,也看一下

 [root@localhost httpd-2.4.62]# ll -dZ /usr/sbin/httpd 
lrwxrwxrwx. 1 root root unconfined_u:object_r:bin_t:s0 29 Dec 14 09:24 /usr/sbin/httpd -> /www/server/apache2/bin/httpd
[root@localhost httpd-2.4.62]#
[root@localhost httpd-2.4.62]# ll -dZ /www/server/apache2/bin/httpd 
-rwxr-xr-x. 1 root root unconfined_u:object_r:default_t:s0 2899314 Dec 12 09:18 /www/server/apache2/bin/httpd
[root@localhost httpd-2.4.62]#

/www/server/apache2/bin/httpd ​ 并没有 bin_t​ 这个类型:

[root@localhost httpd-2.4.62]# chcon -t bin_t /www/server/apache2/bin/httpd
[root@localhost httpd-2.4.62]# 
[root@localhost httpd-2.4.62]# ll -dZ /www/server/apache2/bin/httpd 
-rwxr-xr-x. 1 root root unconfined_u:object_r:bin_t:s0 2899312 Dec 14 09:18 /www/server/apache2/bin/httpd
[root@localhost httpd-2.4.62]# 

标签:httpd,service,EXEC,--,62,root,localhost,2.4
From: https://www.cnblogs.com/zhpj/p/18606956/httpdservice-failed-at-step-exec-spawning-usrsbinh

相关文章

  • systemctl start httpd 卡住
    systemctlstarthttpd卡住‍根据ApacheModulemod_systemd模块的说明,编译时添加了--enable-systemd​参数;‍安装完成之后,注册为systemd服务,通过systemctlstarthttpd启动时命令行卡住:[root@localhost~]#cat/usr/lib/systemd/system/httpd.service[Unit]Des......
  • httpd.service: Failed at step EXEC spawning usrsbinhttpd: Permission denied
    httpd.service:FailedatstepEXECspawningusrsbinhttpd:Permissiondenied‍apache编译安装之后,通过apachectlstart可以正常启动,注册为systemd服务时启动不了:[root@localhosthttpd-2.4.62]#systemctlstarthttpd.serviceJobforhttpd.servicefailedbecause......
  • 为什么在生成静态页或上传附件时出现“Maximum execution time of 30 seconds exceede
    在使用易优EyouCms生成静态页或上传附件时,如果遇到“Maximumexecutiontimeof30secondsexceeded”的错误提示,这通常是因为服务器上的PHP脚本执行时间超过了默认的最大执行时间限制。默认情况下,PHP的 max_execution_time 设置为30秒,这意味着如果脚本执行时间超过30秒,将会被......
  • Win10提示systemserviceexception蓝屏代码怎么办?
    在使用电脑的过程中,不少朋友都遇到过蓝屏的现象,像小编就遇到了systemserviceexception蓝屏终止代码,那么遇到这种蓝屏代码应该要怎么办呢?下面就和小编一起来看看有什么解决方法吧。Win10提示systemserviceexception蓝屏代码的解决方法方法一1、使用Windows键+R......
  • builder.Services.AddMvc
    在.NET中,builder.Services.AddMvc是一个用于在ASP.NETCore应用程序中添加MVC框架服务的方法。当你在构建服务容器时调用这个方法,它会将MVC框架所需的服务添加到服务容器中。以下是一些关键点:添加MVC服务:AddMvc方法会将MVC框架所需的所有服务添加到服务容器中,包括路由、模型......
  • k8s系列之五通过Service访问Pod
    参考:https://blog.csdn.net/u011067966/article/details/135885967 1.0变更因本地原因,k8s系列之二集群环境搭建以及插件安装中的虚拟机更换为以下3个节点,后续文章均在此三个节点上实践:节点   ipk8s-master   192.168.200.128k8s-node1   192.168.200.129k8s-node2......
  • ServiceMesh 5:异常重试和超时保护提升服务可用性
    ★ServiceMesh系列1背景在复杂的互联网场景中,不可避免的会出现请求失败或者超时的情况。从程序的的响应结果来看,一般是Response返回5xx状态的错误;从用户的角度去看,一般是请求结果不符合预期,即操作失败(如转账失败、下单失败、信息获取不到等)。偶发的不可避免的5xx请求错误,产......
  • ntp-service unicast-server命令的含义
    ntp-serviceunicast-server 是网络时间协议(NTP)配置中的一项,用于在设备(如路由器或交换机)上设置NTP服务,以单播模式与特定时间服务器进行同步。以下是相关概念和配置说明:1.什么是单播模式(UnicastMode)单播模式是NTP的一种通信方式,设备直接向指定的NTP服务器发送时......
  • JAVA中ScheduledExecutorService的使用方法
    ScheduledExecutorService简介ScheduledExecutorService是Java中的一个接口,它是ExecutorService的子接口。它主要用于在给定的延迟之后或周期性地执行任务。这个接口提供了一种方便的方式来处理异步任务的调度,相比于传统的Timer和TimerTask,它具有更好的灵活性和可靠性,特别是......
  • 调用WebService异常:提供的 URI 方案“https”无效,应为“http”。 (Parameter 'via')
    解决办法:varbinding=newBasicHttpBinding();binding.Security.Mode=BasicHttpSecurityMode.Transport;<bindings><customBinding><bindingname="ZWS_CUST"><mtomMessageEncodingmes......