Deleting a file in Restricted Folder on Linux
I am trying to create a new directory for my apache server. When I tried to access the new directory, I type:
sudo / etc / init.d / apache2 restart
But I am getting this error in Ubuntu terminal:
Syntax error on line 1 of / etc / apache 2 / conf.d / fqdn.save: ServerName takes one argument, hostname and server port.
As I research, the fqdn.save file cannot be accessed and is considered unknown. I want to delete this file, but I cannot because I believe I need root access.
Does anyone know how to delete this junk file in Ubuntu? Or does anyone know how to redirect the restart of apache2 to / etc / apache 2 / conf.d / fqdn (instead of fqdn.save) when I type "sudo / etc / init.d / apache restart" in terminal
please and thank you
You have sudo; I'm going to assume that the standard Ubuntu sudo blanket allows you to do anything.
Check that in the file:
sudo cat /etc/apache2/conf.d/fqdn.save
Make a backup copy of the file, just in case:
sudo cp /etc/apache2/conf.d/fqdn.save /tmp
Delete the file:
sudo rm /etc/apache/conf.d/fqdn.save
And then at that point you should be able to start the server ...
source to share
You need to be inside a group with permissions to write this file and it will probably be apache and root (both user and group), im not quite sure about the apache group name in ubuntu, but if you are a regular user you were afraid you you can't just delete the file, ask the system administrator or someone who has rights to that file.
On the other hand, deleting a file will not work if the init script "apache2" has a link to it, instead you will probably get another error stating that the file was not found.
So your problem is that you have an init script apache trying to access the wrong filename, I believe the solution is to edit the init script apache and point it to the correct filename and that would be fqdn instead of fqdn.save
source to share