Ignore hidden files in /sshkeys/clients
This commit is contained in:
parent
1b4ea9e2a0
commit
bc6902fde4
2 changed files with 3 additions and 3 deletions
|
@ -78,7 +78,7 @@ We will need two persistent storage directories for our borgserver to be usefull
|
||||||
This directory has two subdirectories:
|
This directory has two subdirectories:
|
||||||
|
|
||||||
##### /sshkeys/clients/
|
##### /sshkeys/clients/
|
||||||
Here we will put all SSH public keys from our borg clients, we want to backup. Every key must be it's own file, containing only one line, with the key. The name of the file will become the name of the borg repository, we need for our client to connect.
|
Here we will put all SSH public keys from our borg clients, we want to backup. Every key must be it's own file, containing only one line, with the key. The name of the file will become the name of the borg repository, we need for our client to connect. Hidden files are ignored.
|
||||||
|
|
||||||
That means every client get's it's own repository. So you might want to use the hostname of the client as the name of the sshkey file.
|
That means every client get's it's own repository. So you might want to use the hostname of the client as the name of the sshkey file.
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ for dir in BORG_DATA_DIR SSH_KEY_DIR ; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(find ${SSH_KEY_DIR}/clients -type f | wc -l)" == "0" ] ; then
|
if [ "$(find ${SSH_KEY_DIR}/clients -type f -not -iname ".*" | wc -l)" == "0" ] ; then
|
||||||
echo "ERROR: No SSH-Pubkey file found in ${SSH_KEY_DIR}"
|
echo "ERROR: No SSH-Pubkey file found in ${SSH_KEY_DIR}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -48,7 +48,7 @@ echo " * Starting SSH-Key import..."
|
||||||
|
|
||||||
# Add every key to borg-users authorized_keys
|
# Add every key to borg-users authorized_keys
|
||||||
rm /home/borg/.ssh/authorized_keys &>/dev/null
|
rm /home/borg/.ssh/authorized_keys &>/dev/null
|
||||||
for keyfile in $(find "${SSH_KEY_DIR}/clients" -type f); do
|
for keyfile in $(find "${SSH_KEY_DIR}/clients" -type f -not -iname ".*"); do
|
||||||
client_name=$(basename ${keyfile})
|
client_name=$(basename ${keyfile})
|
||||||
mkdir ${BORG_DATA_DIR}/${client_name} 2>/dev/null
|
mkdir ${BORG_DATA_DIR}/${client_name} 2>/dev/null
|
||||||
echo " ** Adding client ${client_name} with repo path ${BORG_DATA_DIR}/${client_name}"
|
echo " ** Adding client ${client_name} with repo path ${BORG_DATA_DIR}/${client_name}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue