From 3d12fc16c6ef9b3c686ef55e38773323dd21cff2 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 1 Nov 2019 17:39:35 +0800 Subject: [PATCH] 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 --- src/ceph-daemon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ceph-daemon b/src/ceph-daemon index a5c708e9655..71cd85f9547 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') -- 2.39.5