diff --git a/README.md b/README.md index 0aca85c..140419d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ docker run -dp 3000:22 \ ## Use after setup ``` -export BORG_REPO='ssh://borg@localhost:3000/backups' +export BORG_REPO='ssh://borg@localhost:3000/backups' borg init -e none # any borg command you like ``` diff --git a/entrypoint.sh b/entrypoint.sh index 34c4be8..186db29 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,7 +37,13 @@ function add_borg_user { function make_and_import_ssh_keys { local create_folders="0" - touch "/.ssh/authorized_keys" + + if [ ! -f "/.ssh/authorized_keys" ]; then + touch "/.ssh/authorized_keys" + else + rm "/.ssh/authorized_keys" + touch "/.ssh/authorized_keys" + fi for key in ${SSH_FOLDERS[@]}; do if [ ! -d "${key}" ]; then @@ -59,7 +65,7 @@ function make_and_import_ssh_keys { FILES=$(ls -1 /sshkeys/clients) for key in $FILES; do echo "- Adding SSH-Key $key" - cat "/sshkeys/clients/$key" > "/.ssh/authorized_keys" + cat "/sshkeys/clients/$key" >> "/.ssh/authorized_keys" done echo "" >> "/.ssh/authorized_keys"