Prevent a user from changing a specific line in a textfile
I'm working on a Control Panel for my communities minecraft servers. I want to keep the option to give away servers to other people too. Minecraft servers have a configfile which has the option IP/Port in it. Since people will have direct access to the file via FTP i still dont want them to change the port however the rest of it must be editable. Is there any good way to prevent users from doing so? The only idea i have at the moment is to grab the prot for each server from a database which only root users can access and then echo the port into the file just before each server start/restart.
To reply on your title: "Prevent a user from changing a specific line in a textfile". This is unfortunately not possible.
Keep all editable data in one file where you grant them write-access, or create a simple GUI where the port is set, but the rest is editable (and then make sure they don't have access to change the actual settings file).