CBQE-2323: fix write files for non root user

Change-Id: I577cf14b9695ab8b306e5c1b646140469ec898ca
Reviewed-on: http://review.couchbase.org/39306
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Iryna Mironava <irynamironava@yandex.ru>