From: Sage Weil Date: Fri, 6 Dec 2019 21:14:31 +0000 (-0600) Subject: ceph-daemon: fix bootstrap ownership of tmp monmap file X-Git-Tag: v15.1.0~626^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32e06caa35e60cf816f655bd6079d7fbe0314eb2;p=ceph.git ceph-daemon: fix bootstrap ownership of tmp monmap file The file is created with mode 0644 by the ceph:ceph user, but root cannot write to that. Instead, create the tmp file owned by root, write to it, then chown it to user ceph. Fixes e92929d86dce2297d3e02ec88c6830224aefc061 Signed-off-by: Sage Weil --- diff --git a/src/ceph-daemon/ceph-daemon b/src/ceph-daemon/ceph-daemon index 7edfccc4632b..3795f3965366 100755 --- a/src/ceph-daemon/ceph-daemon +++ b/src/ceph-daemon/ceph-daemon @@ -1066,7 +1066,7 @@ def command_bootstrap(): # create initial monmap, tmp monmap file logger.info('Creating initial monmap...') - tmp_monmap = write_tmp('', uid, gid) + tmp_monmap = write_tmp('', 0, 0) out = CephContainer( image=args.image, entrypoint='/usr/bin/monmaptool', @@ -1081,6 +1081,9 @@ def command_bootstrap(): }, ).run() + # pass monmap file to ceph user for use by ceph-mon --mkfs below + os.fchown(tmp_monmap.fileno(), uid, gid) + # create mon logger.info('Creating mon...') create_daemon_dirs(fsid, 'mon', mon_id, uid, gid)