0

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.

bjw
  • 101

1 Answers1

0

A friend has just recommended Augeas which is the perfect solution:

Edit a file via bash script

bjw
  • 101