diff options
Diffstat (limited to 'ci.d/openssh')
-rw-r--r-- | ci.d/openssh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ci.d/openssh b/ci.d/openssh new file mode 100644 index 0000000..4abeb02 --- /dev/null +++ b/ci.d/openssh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +# ssh_copy_host_key +# ssh_copy_host_key user home +ssh_copy_host_key() { + USER=root + USER_HOME=/root + if [ -n "$2" ] + then + USER=$1 + USER_HOME=$2 + fi + lxc_do mkdir -p $USER_HOME/.ssh + lxc_do chmod 700 $USER_HOME/.ssh + lxc_do chown $USER:$USER $USER_HOME/.ssh + </root/.ssh/id_ecdsa lxc_do bash -c "cat > $USER_HOME/.ssh/id_ecdsa" + lxc_do chmod 600 $USER_HOME/.ssh/id_ecdsa + lxc_do chown $USER:$USER $USER_HOME/.ssh/id_ecdsa + </root/.ssh/known_hosts lxc_do bash -c "cat > $USER_HOME/.ssh/known_hosts" + lxc_do chmod 600 $USER_HOME/.ssh/known_hosts + lxc_do chown $USER:$USER $USER_HOME/.ssh/known_hosts +} |