Apache 사용자로 sudoing 시 환경 변수 설정

Apache 사용자로 sudoing 시 환경 변수 설정

모든 사이트의 파일이 \www\sitename\htdocs\사용자 "apache"에 속하는 centos 7 webserer가 있습니다.

때로는 git pull아파치 사용자가 되어야 하기 때문에 간단한 sudo 스크립트를 아파치로 작성했습니다.

[ansible@vm123123 ~]$ cat ~/suwu.sh
#!/bin/sh

sudo setfacl -m apache:x   $(dirname "$SSH_AUTH_SOCK")
sudo setfacl -m apache:rwx "$SSH_AUTH_SOCK"

sudo -E su -s /bin/sh apache
[ansible@vm123123 ~]$

잘 작동합니다. Apache 사용자로 로그인하고, 파일을 변경하고, SSH 키를 git 서버로 전달할 수 있습니다.

하지만 mc아파치로는 시작할 수 없습니다:

sh-4.2$ mc

(mc:36339): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Cannot create "/usr/share/httpd/.cache/mc"

(mc:36339): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Cannot create "/usr/share/httpd/.local/share/mc"
Сбой запуска:
Cannot create "/usr/share/httpd/.config/mc"
sh-4.2$

이것이 제가 mc를 다음과 같이 운영하는 이유입니다.

sh-4.2$ MC_HOME=/tmp/MCHOME mc

MC_HOME이것은 작동하지만 내 스크립트나 다른 곳에서 아파치를 한 번 설정하는 방법이 있습니까 ?

관련 정보