How to edit Fedora Server system files from a script

Viewed 13

I'm trying to be clever and use a script to set specific configuration values in system files like /etc/ssh/sshd_config, /etc/audit/audit_rules, etc. when I deploy a new Fedora Server 36. The script may run as root.

The tools at my disposal are bash and python.

In my head it would look something like:

#!/pseudo code
for line in /path/to/firefox/policies.json
do
     set.PopupBlocking({"Allow":"","Default":true,"Locked":true})
done

OR

sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_conf

next setting

I've also looked at using jq .container[].InstallAddonsPermission: {"Default": false} /path/to/firefox/policies.json.

What is the best practice for this type of task? Is there a python method that would work better than bash? TIA!

0 Answers
Related