[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Updating config files: permissions!?

On Sat, Feb 26, 2005 at 12:12:31AM +0100, Torsten Landschoff wrote:
> During upgrades the slapd package (for example) has to do some
> adjustments on config files (it asks the user for permission of course). 
> Problem: How do I make sure the new config files have the same
> permissions!? Currently I do
> 	chmod --reference=OLD NEW
> 	chown --reference=OLD NEW
> 	mv NEW OLD
> but this will break with ACLs. And what happens with SELinux!? Can't
> find anything in debian-policy about it, shouldn't we define that
> handling?

You can't solve this problem atomically. However, you can do this:

cat NEW > TMP
rm NEW

Which is almost as good. The point being that rather than create a new
file, you truncate the old one and replace its contents (but avoid
ever leaving a half-populated file in place; no file is better than a
mangled file).

  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

Reply to: