On a new VPS I might want to ensure that certain config values are set, or amended if they already exist. For example in /etc/systemd/journald.conf
I want to set SystemMaxUse=100M
if it's not already set, or in /etc/ssh/sshd_config
I want PasswordAuthentication no
.
I could write regex/replaces but I'm lazy. Is there a nice/general way to ensure values like this are set, without simply appending to the end of the conf file? Appending seems hacky and would potentially end up with duplicate lines.