我正在尝试使用从PHP exec
调用的bash文件编辑/etc/httpd/conf.d/ssl.conf:
#comment those lines in ssl.conf
sed -i 's/^SSLCertificateFile/#SSLCertificateFile/g' /etc/httpd/conf.d/ssl.conf
sed -i 's/^SSLCertificateKeyFile/#SSLCertificateKeyFile/g' /etc/httpd/conf.d/ssl.conf
#uncomment those lines in ssl.conf
sed -i 's/^#SSLCertificateFile/SSLCertificateFile/g' /etc/httpd/conf.d/ssl.conf
sed -i 's/^#SSLCertificateKeyFile/SSLCertificateKeyFile/g' /etc/httpd/conf.d/ssl.conf
但是我收到了这个错误:
sed: couldn't open temporary file /etc/httpd/conf.d/sed3nRibG: Permission denied
sed: couldn't open temporary file /etc/httpd/conf.d/sed2ASgeG: Permission denied
我将所有者更改为apache
并将a+xw
文件的ssl.conf
权限更改为但是没有帮助。
任何想法?
答案 0 :(得分:0)
sed尝试创建临时文件...查看错误...并且无权写入目录( /etc/httpd/conf.d )
请参阅sed command creates randomly named files了解可能的其他解决方案
答案 1 :(得分:0)
我将主机放在一个单独的并更改所有者的整个文件夹中:
chown apache:apache /etc/https/conf.d
chown apache:apache /etc/https/conf.d/*
和那些bash中的行:
#comment those lines in vhosts.conf
sed -i 's/^SSLCertificateFile/#SSLCertificateFile/g' /etc/httpd/conf.d/vhosts.conf
sed -i 's/^SSLCertificateKeyFile/#SSLCertificateKeyFile/g' /etc/httpd/conf.d/vhosts.conf
#uncomment those lines in vhosts.conf
sed -i 's/^#SSLCertificateFile/SSLCertificateFile/g' /etc/httpd/conf.d/vhosts.conf
sed -i 's/^#SSLCertificateKeyFile/SSLCertificateKeyFile/g' /etc/httpd/conf.d/vhosts.conf