Atomic file writes via rename(1) and lots of (optional) sanity checks to ensure that things have not gone awry, for example if the new /etc/passwd is of 0 size, perhaps do not copy it into place? To install this module, use CPAN, for example: cpan File::AtomicWrite The source tree is available at: http://github.com/thrig/File-AtomicWrite/ This can be built and installed by running: perl Makefile.PL make make test make install The documentation can then be read via: perldoc File::AtomicWrite COPYRIGHT AND LICENCE Copyright (C) 2009-2016 Jeremy Mates This module is free software; you can redistribute it and/or modify it under the Artistic License (2.0).