Pregunta

I'm trying to edit /etc/httpd/conf.d/ssl.conf with bash file I called from PHP exec:

 #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

but I'm getting this error :

   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

I changed the owner to apache and permission to a+xw of the ssl.conf file but it didn't help .
any idea ?

¿Fue útil?

Solución 2

I put hosts in a separate and change owner the whole folder :

chown apache:apache /etc/https/conf.d
chown apache:apache /etc/https/conf.d/*

and those the lines in 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

Otros consejos

sed tries to create a temp file... see the errors... and has no permission to write to the directory ( /etc/httpd/conf.d )

see sed command creates randomly named files for possible other solutions

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top