From: Daniel Pivonka Date: Mon, 29 Mar 2021 17:47:11 +0000 (-0400) Subject: cephadm: fix failure when using --apply-spec and --shh-user X-Git-Tag: v15.2.13~20^2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8ec8e6e6b03e45a351fc819202425bcbd0e36297;p=ceph.git cephadm: fix failure when using --apply-spec and --shh-user ssh-copy-id was being run as the root user because cephadm requires sudo so it was trying to use the root users ssh keys to copy the cephadm ssh key to the hosts in the spec this would fail if the root user did not has passwordless ssh to the host being added solution run ssh-copy-id as the user ssh-user additionally fix the check to not copy the cephadm ssh key to the bootstrap host Signed-off-by: Daniel Pivonka (cherry picked from commit 33c843f8a275d6f01d824c6fa066fbd771b6e9fc) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index bda708a7052..e7510218ccf 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3304,7 +3304,7 @@ def command_bootstrap(): ssh_key = '/etc/ceph/ceph.pub' if args.ssh_public_key: ssh_key = args.ssh_public_key.name - out, err, code = call_throws(['ssh-copy-id', '-f', '-i', ssh_key, '%s@%s' % (args.ssh_user, split[1])]) + out, err, code = call_throws(['sudo', '-u', args.ssh_user, 'ssh-copy-id', '-f', '-i', ssh_key, '-o StrictHostKeyChecking=no', '%s@%s' % (args.ssh_user, split[1])]) mounts = {} mounts[pathify(args.apply_spec)] = '/tmp/spec.yml:z'