From bea48dcbd0feff28c89616894f160c4c6ca488c7 Mon Sep 17 00:00:00 2001 From: GARDAIS Jeremy Date: Tue, 21 Nov 2017 18:03:43 +0100 Subject: [PATCH] Add a specific ssh user for Windows DSI computer. See bugzilla 1956. --- server/add_backuppc_host.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/server/add_backuppc_host.sh b/server/add_backuppc_host.sh index dc09347..bf95aed 100755 --- a/server/add_backuppc_host.sh +++ b/server/add_backuppc_host.sh @@ -56,6 +56,7 @@ hostname=$(echo ${fqdn} | cut -d'.' -f1) mail=$(grep "# mail:" ${config_pl_path} | cut -d':' -f 2) mail_ur1=$(echo ${mail} | cut -d'@' -f2) username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"')' -b "dc=univ-rennes1,dc=fr" -x uid | grep "^uid" | cut -d" " -f2) +backup_username=$(grep "# username:" ${config_pl_path} | cut -d':' -f 2) #printf "IP: ${ip}\n" #printf "temp_fqdn ${temp_fqdn}\n" @@ -63,6 +64,7 @@ username=$(ldapsearch -ZZ -H ldap://ldap.univ-rennes1.fr -LLL '(mail='"${mail}"' #printf "hostname ${hostname}\n" #printf "mail: ${mail}\n" #printf "username: ${username}\n" +#printf "backup_username: ${backup_username}\n" #### TESTS #### # Check IP @@ -107,17 +109,23 @@ fi # Host jfade.pr079076 # hostname pr079076.spm.univ-rennes1.fr if [[ ! $(grep "${username}.${hostname}" "${backuppc_ssh_config_file}") ]]; then - cat << EOF >> "${backuppc_ssh_config_file}" + cat << EOF >> "${backuppc_ssh_config_file}" Host ${username}.${hostname} hostname ${fqdn} +EOF + + # Pour une machine Windows DSI, backup_user particulier + if [[ ${backup_username} ]]; then + cat << EOF >> "${backuppc_ssh_config_file}" + user "${backup_username}" EOF - #cat << EOF -#WRITE TO "${backuppc_ssh_config_file}": -#Host ${username}.${hostname} - #hostname ${fqdn} + else + cat << EOF >> "${backuppc_ssh_config_file}" + +EOF + fi -#EOF fi #### DÉFINIR LE NOM D'HOTE POUR LE SYSTEME ####