我正试图用从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
,并将权限更改为ssl.conf
文件的a+xw
,但这没有帮助
知道吗?
请参阅sed命令为可能的其他解决方案创建随机命名的文件
我将主机放在一个单独的文件夹中,并更改所有者整个文件夹:
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