天天看點

解決 (code=exited, status=203/EXEC) 問題,關閉 openEuler 的SELinux與防火牆 firewall

緣起

一系列服務直接從

Ubuntu

遷移至

openEuler

後, 發現很多

Systemd

服務啟動失敗。 報錯

(code=exited, status=203/EXEC)

通過檢查系統日志

tail -f /var/log/messages

發現以下關鍵資訊:

  1. systemd 執行xxx程式 權限拒絕。

    systemd[5646]: xxx.service: Failed to locate executable /root/server/xxx/xxx: Permission denied

  2. 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

檢視防火牆狀态

有兩種方式:

  1. 執行指令

    firewall-cmd --state

    運作中
    running
    未啟用
    not running
  2. 執行指令

    systemctl status firewalld.service

    運作中
    Active: active (running)
    未啟用
    Active: inactive (dead)

關閉防火牆

  1. 關閉防火牆服務

    systemctl stop firewalld.service

  2. 關閉防火牆開機自啟

    systemctl disable firewalld.service

SELinux

檢視SELinux狀态

  1. 使用指令

    SELinux

    啟用
    Enforcing
    如果違反安全政策, 不會拒絕操作,僅記錄日志。
    Permissive
    未啟用
    Disabled

關閉 SELinux

  1. 編輯配置檔案

    vim /etc/selinux/config

    , 将

    SELINUX=enforcing

    改為

    SELINUX=disabled

  2. 重新開機生效

    shutdown -r now

繼續閱讀