Add a specific ssh user for Windows DSI computer.

See bugzilla 1956.
This commit is contained in:
Jeremy Gardais 2017-11-21 18:03:43 +01:00
parent 2d4901769e
commit bea48dcbd0
1 changed files with 14 additions and 6 deletions

View File

@ -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 ####