From: Kefu Chai Date: Fri, 1 Nov 2019 09:39:35 +0000 (+0800) Subject: ceph-daemon: create ~/.ssh if not exist X-Git-Tag: v15.1.0~1089^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3d12fc16c6ef9b3c686ef55e38773323dd21cff2;p=ceph.git ceph-daemon: create ~/.ssh if not exist there is chance that /root/.ssh does not exist yet, when we are trying to add key to authorized_keys. Signed-off-by: Kefu Chai --- diff --git a/src/ceph-daemon b/src/ceph-daemon index a5c708e96558..71cd85f9547b 100755 --- a/src/ceph-daemon +++ b/src/ceph-daemon @@ -1062,6 +1062,8 @@ def command_bootstrap(): ).run() logger.info('Adding key to root@localhost\'s authorized_keys...') + if not os.path.exists('/root/.ssh'): + os.mkdir('/root/.ssh', mode=0o700) with open('/root/.ssh/authorized_keys', 'a') as f: os.fchmod(f.fileno(), 0o600) # just in case we created it f.write(ssh_pub.strip() + '\n')