fix bug of only one ssh key can be added
This commit is contained in:
@@ -12,7 +12,7 @@ docker run -dp 3000:22 \
|
|||||||
|
|
||||||
## Use after setup
|
## Use after setup
|
||||||
```
|
```
|
||||||
export BORG_REPO='ssh://borg@localhost:3000/backups'
|
export BORG_REPO='ssh://borg@localhost:3000/backups'
|
||||||
borg init -e none
|
borg init -e none
|
||||||
# any borg command you like
|
# any borg command you like
|
||||||
```
|
```
|
||||||
|
|||||||
+8
-2
@@ -37,7 +37,13 @@ function add_borg_user {
|
|||||||
|
|
||||||
function make_and_import_ssh_keys {
|
function make_and_import_ssh_keys {
|
||||||
local create_folders="0"
|
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
|
for key in ${SSH_FOLDERS[@]}; do
|
||||||
if [ ! -d "${key}" ]; then
|
if [ ! -d "${key}" ]; then
|
||||||
@@ -59,7 +65,7 @@ function make_and_import_ssh_keys {
|
|||||||
FILES=$(ls -1 /sshkeys/clients)
|
FILES=$(ls -1 /sshkeys/clients)
|
||||||
for key in $FILES; do
|
for key in $FILES; do
|
||||||
echo "- Adding SSH-Key $key"
|
echo "- Adding SSH-Key $key"
|
||||||
cat "/sshkeys/clients/$key" > "/.ssh/authorized_keys"
|
cat "/sshkeys/clients/$key" >> "/.ssh/authorized_keys"
|
||||||
done
|
done
|
||||||
echo "" >> "/.ssh/authorized_keys"
|
echo "" >> "/.ssh/authorized_keys"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user