一系列服务直接从 Ubuntu
迁移至 openEuler
后, 发现很多Systemd
服务启动失败。 报错(code=exited, status=203/EXEC)
。
通过检查系统日志tail -f /var/log/messages
发现以下关键信息:
systemd[5646]: xxx.service: Failed to locate executable /root/server/xxx/xxx: Permission denied
SELinux
阻止xxx程序访问xxx文件。setroubleshoot[5649]: SELinux is preventing (xxx) from execute access on the file xxx. For complete SELinux messages run: sealert -l xxxxx
由于在本地环境相对安全,为了使服务立即上线,这里简单粗暴地直接关闭 SELinux
和 Firewall
。
有两种方式:
执行命令firewall-cmd --state
运行中
running
未启用
not running
执行命令systemctl status firewalld.service
运行中
Active: active (running)
未启用
Active: inactive (dead)
systemctl stop firewalld.service
systemctl disable firewalld.service
使用命令SELinux
启用
Enforcing
如果违反安全策略, 不会拒绝操作,仅记录日志。
Permissive
未启用
Disabled
vim /etc/selinux/config
, 将SELINUX=enforcing
改为 SELINUX=disabled
。shutdown -r now