Fix for 1804

At creation time we were always assigning 0600 as mode to the new file.
This fix stats the source file first and assigns the same mode as the
original file.
Acceptance tests are updated too.