diff --git a/app/views/unattended/provisioning_templates/snippet/remote_execution_ssh_keys.erb b/app/views/unattended/provisioning_templates/snippet/remote_execution_ssh_keys.erb index 0d57a10243c..0818e50c4b5 100644 --- a/app/views/unattended/provisioning_templates/snippet/remote_execution_ssh_keys.erb +++ b/app/views/unattended/provisioning_templates/snippet/remote_execution_ssh_keys.erb @@ -57,7 +57,9 @@ EOF chmod 0700 <%= ssh_path %> chmod 0600 <%= ssh_path %>/authorized_keys chown -R <%= "#{ssh_user}:" %> <%= ssh_path %> +<% if ssh_user != 'root' -%> chown -R <%= "#{ssh_user}:" %> <%= "~#{ssh_user}" %> +<% end -%> # Restore SELinux context with restorecon, if it's available: command -v restorecon && restorecon -RvF <%= ssh_path %> || true