From 4d41973e9200e088114c530366d630240191a7ab Mon Sep 17 00:00:00 2001 From: GARDAIS Jeremy Date: Wed, 25 Apr 2018 12:03:36 +0200 Subject: [PATCH] Not overwrite user file and fix the use of homedir Don't overwrite authorized_keys if it exist. --- install_backuppc_mac.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_backuppc_mac.sh b/install_backuppc_mac.sh index 0b0fd9f..aee529b 100755 --- a/install_backuppc_mac.sh +++ b/install_backuppc_mac.sh @@ -216,11 +216,11 @@ mv "${filepl}" "${dir1}" # done #### AUTORISER LES CONNEXIONS AU COMPTE UTILISATEUR #### -homeuser="~${usr}" +homeuser=$(eval echo ~"${usr}") printf '\e[1;34m%-6s\e[m' "Autorisation de connexion au compte via SSH…" printf "\n" mkdir -p -- "${homeuser}"/.ssh -echo "from=\"129.20.203.16\" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIhMc8ixQXfWDACJy4q0v8T877UxahhCjO51PQFzylwVpf88LX3yWeDrWIW0NRu0zoSm396mig918OpD5ggqML/QbYbQsoDdAFUV/tK4JU6UJgEQIl25MOcUBCFepsFBGS09CH/V07xSUqSP/+beeTRLNO2CQzk3S2y3YfkXpM7KmOGfeLgoCaQAcxIkgLXeM3TpCZEzJDlZ8c8k/DjVvsgwCpQktYzNo2b37KHLLfgyW9KSo6N9sReUuNQjS6lu8rjrXfc6+J0pY2D6IxWptTWL/JVrhFCUqe4QQy+xYjoR41wqnAQyl/kOcyBNhSvojMKwQT6vlPwru6pOno16/X backuppc@backuppc.ipr.univ-rennes1.fr" > "${homeuser}"/.ssh/authorized_keys +echo "from=\"129.20.203.16\" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIhMc8ixQXfWDACJy4q0v8T877UxahhCjO51PQFzylwVpf88LX3yWeDrWIW0NRu0zoSm396mig918OpD5ggqML/QbYbQsoDdAFUV/tK4JU6UJgEQIl25MOcUBCFepsFBGS09CH/V07xSUqSP/+beeTRLNO2CQzk3S2y3YfkXpM7KmOGfeLgoCaQAcxIkgLXeM3TpCZEzJDlZ8c8k/DjVvsgwCpQktYzNo2b37KHLLfgyW9KSo6N9sReUuNQjS6lu8rjrXfc6+J0pY2D6IxWptTWL/JVrhFCUqe4QQy+xYjoR41wqnAQyl/kOcyBNhSvojMKwQT6vlPwru6pOno16/X backuppc@backuppc.ipr.univ-rennes1.fr" >> "${homeuser}"/.ssh/authorized_keys chown -R "${usr}" "${homeuser}"/.ssh/