From 6719cab41adb9372c37c9f6ae173440dd98dfb16 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Wed, 6 May 2020 08:43:34 +0100 Subject: [PATCH] esxi guest: do not fail when we cannot set the ssh directory permissions in esxi 7.0 --- plugins/guests/esxi/cap/public_key.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/guests/esxi/cap/public_key.rb b/plugins/guests/esxi/cap/public_key.rb index 84f199c39..cd898ad7b 100644 --- a/plugins/guests/esxi/cap/public_key.rb +++ b/plugins/guests/esxi/cap/public_key.rb @@ -24,7 +24,9 @@ module VagrantPlugins set -e SSH_DIR="$(grep -q '^AuthorizedKeysFile\s*\/etc\/ssh\/keys-%u\/authorized_keys$' /etc/ssh/sshd_config && echo -n /etc/ssh/keys-${USER} || echo -n ~/.ssh)" mkdir -p "${SSH_DIR}" - chmod 0700 "${SSH_DIR}" + # NB in ESXi 7.0 we cannot change the /etc/ssh/keys-root directory + # permissions, so ignore any errors. + chmod 0700 "${SSH_DIR}" || true cat '#{remote_path}' >> "${SSH_DIR}/authorized_keys" chmod 0600 "${SSH_DIR}/authorized_keys" rm -f '#{remote_path}'