Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a debian package and I'm wondering if there's a safe way to modify system files. For example, when postinst executes I want to edit /etc/login.defs to alter a setting. I could use sed to do this, which would leave the rest of the file intact.

I'd like to make this something completely reversible, but I'm not sure what Debian packages typically do in this situation. Do they just create a backup named something like /etc/file.conf.backup?

share|improve this question
up vote 1 down vote accepted

Packages should never modify files belonging to other packages.

See at 10.7.4

You can't just edit a configuration file belonging to another package. If that package supports conf.d directory you can put your own configuration file into it.

If the package from where the conffile comes does not provide any tool to edit it, you should ask the question to the debian-devel mailing list.

share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Tog Jan 31 '13 at 8:55
Better if i explain WHY he can't to that? – LtWorf Jan 31 '13 at 12:35
Yes, sorry for the brevity – Tog Feb 6 '13 at 11:59

I think dpkg-divert might be a good solution to my problem:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .