diskimage-builder/elements/local-config/install.d/62-ssh-key
Robert Collins 5695fbd39e Set correct mode for .ssh/authorized_keys files.
Per bug 1182648 we were not setting the mode and as a result couldn't
log in, defeating the purpose of having a local-config element :).

Change-Id: I4114b9536392f1517eac8f4bbe6f4b60ce1186a1
2013-05-24 12:01:57 +12:00

13 lines
334 B
Bash
Executable File

#!/bin/bash
# Save user SSH public key if available.
# XXX: Obviously not suitable for downloadable images.
set -e
if [ -e "/tmp/in_target.d/ssh-authorized-keys" ]; then
mkdir -p /root/.ssh
cat /tmp/in_target.d/ssh-authorized-keys >> /root/.ssh/authorized_keys
chmod 0700 /root/.ssh
chmod 0600 /root/.ssh/authorized_keys
fi