#!/bin/bash
#
# Créé le : mercredi 27 février 2008, 23:38:59 (UTC+0100)
#
# Racine : /home/santos/rsync/test/root
#
##### Vérifications préliminaires #####
# vérification de l'utilisateur qui exécute le programme
if [ `whoami` != "root" ]
then
echo 'Vous devez être root pour exécuter ce programme.'
exit 1
fi
# vérification de l'existence de la racine
test -d /home/santos/rsync/test/root
if [ $? != 0 ]
then
echo /home/santos/rsync/test/root' : répertoire introuvable.'
exit 1
fi
echo "Restauration des droits sur le répertoire et son contenu :"
echo " /home/santos/rsync/test/root"
##### DEBUT #####
chown root:root "/home/santos/rsync/test/root"
chown root:root "/home/santos/rsync/test/root/root_test"
chown santos:santos "/home/santos/rsync/test/root/santos"
chown santos:santos "/home/santos/rsync/test/root/santos/santos_777"
chown santos:santos "/home/santos/rsync/test/root/santos/tony_default"
chown tony:tony "/home/santos/rsync/test/root/tony"
chown tony:tony "/home/santos/rsync/test/root/tony/tony_777"
chown tony:tony "/home/santos/rsync/test/root/tony/tony_default"
##### FIN #####
echo "Droits restaurés aevc succès."
[^] # Re: Solutions alternatives
Posté par santos . En réponse au message Rsync : restaurer une sauvegarde. Évalué à 1.
#!/bin/bash
#
# Créé le : mercredi 27 février 2008, 23:38:59 (UTC+0100)
#
# Racine : /home/santos/rsync/test/root
#
##### Vérifications préliminaires #####
# vérification de l'utilisateur qui exécute le programme
if [ `whoami` != "root" ]
then
echo 'Vous devez être root pour exécuter ce programme.'
exit 1
fi
# vérification de l'existence de la racine
test -d /home/santos/rsync/test/root
if [ $? != 0 ]
then
echo /home/santos/rsync/test/root' : répertoire introuvable.'
exit 1
fi
echo "Restauration des droits sur le répertoire et son contenu :"
echo " /home/santos/rsync/test/root"
##### DEBUT #####
chown root:root "/home/santos/rsync/test/root"
chown root:root "/home/santos/rsync/test/root/root_test"
chown santos:santos "/home/santos/rsync/test/root/santos"
chown santos:santos "/home/santos/rsync/test/root/santos/santos_777"
chown santos:santos "/home/santos/rsync/test/root/santos/tony_default"
chown tony:tony "/home/santos/rsync/test/root/tony"
chown tony:tony "/home/santos/rsync/test/root/tony/tony_777"
chown tony:tony "/home/santos/rsync/test/root/tony/tony_default"
##### FIN #####
echo "Droits restaurés aevc succès."