From 0c8637b638e505903f96aed0455461a7ffe94de8 Mon Sep 17 00:00:00 2001 From: GARDAIS Jeremy Date: Wed, 25 Apr 2018 11:22:07 +0200 Subject: [PATCH] Activate DEBUG, don't perform any action on the system --- install_backuppc_mac.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/install_backuppc_mac.sh b/install_backuppc_mac.sh index da02f5b..8870a7a 100755 --- a/install_backuppc_mac.sh +++ b/install_backuppc_mac.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Automatisation de configuration backuppc pour poste linux +# Automatisation de configuration backuppc pour poste MAC # Institut de Physique de Rennes UMR6251 -# Anthony CARRÉ, Jérémy GARDAIS, Guillaume RAFFY — Mars 2016 +# Jérémy GARDAIS, Guillaume RAFFY — Avril 2018 SUCCESS=0 ERROR=1 @@ -18,14 +18,16 @@ function allowUserToConnectToThisMachineUsingSsh() { local userLogin="$1" - dscl . append '/Groups/com.apple.access_ssh' user "${userLogin}" - dscl . append /Groups/com.apple.access_ssh groupmembers $(dscl . read "/Users/${userLogin}" GeneratedUID | cut -d " " -f 2) + #dscl . append '/Groups/com.apple.access_ssh' user "${userLogin}" + #dscl . append /Groups/com.apple.access_ssh groupmembers $(dscl . read "/Users/${userLogin}" GeneratedUID | cut -d " " -f 2) + printf '\e[1;31m%-6s\e[m' "DEBUG : Autoriser les accès SSH pour ${userLogin}." } function ensurePingIsAllowed() { - sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off + #sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off + printf '\e[1;31m%-6s\e[m' "DEBUG : Désactivation du mode furtif (ping)." if [ $? != 0 ]; then printf '\e[1;31m%-6s\e[m' "La désactivation du mode furtif a échoué"; return "$ERROR" fi @@ -33,14 +35,16 @@ function ensurePingIsAllowed() function ensureSshdIsRunning() { - sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null + #sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null + printf '\e[1;31m%-6s\e[m' "DEBUG : Vérification si sshd est déjà en cours." if [ $? != 0 ]; then # enable 'Remote login' in 'system preferences' sudo launchctl enable system/com.openssh.sshd &> /dev/null sudo launchctl load /System/Library/LaunchDaemons/ssh.plist &> /dev/null fi - sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null + #sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null + printf '\e[1;31m%-6s\e[m' "DEBUG : Activation du serveur ssh." if [ $? != 0 ]; then printf '\e[1;31m%-6s\e[m' "L'activation du serveur ssh a échoué"; return "$ERROR" fi