You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
642 B

#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
# Generate a key thusly
# ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1] [-N new_passphrase] [-C comment] [-f output_keyfile]
# ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname`
set -x
export BORG_SERVER="user@host"
export BORG_SSHPUBKEY="/root/.ssh/id_ed25519-borg-`hostname`.pub"
# To make it the only key:
#scp $BORG_SSHPUBKEY $BORG_SERVER:.ssh/authorized_keys
# To append the key to existing ssh keys:
cat $BORG_SSHPUBKEY | ssh $BORG_SERVER 'dd of=.ssh/authorized_keys oflag=append conv=notrunc'