diff --git a/lib/perl/centreon/script/centcore.pm b/lib/perl/centreon/script/centcore.pm
index a0c922aa062e7d1ec2cf6724f3e7043ff1884921..d9b5ac009f11b32d5cb804d17d87c57ade4e4ff7 100644
--- a/lib/perl/centreon/script/centcore.pm
+++ b/lib/perl/centreon/script/centcore.pm
@@ -819,7 +819,7 @@ sub testConfig($) {
     my $data = $self->getServerConfig($id);
     my $port = checkSSHPort($data->{ssh_port});
     my $distantconnexion = $data->{ns_ip_address};
-    $cmd = "$self->{ssh} -p ".$port." $distantconnexion $self->{sudo} ".$data->{nagios_bin}." -v $cfg_dir/nagios.cfg";
+    $cmd = "$self->{ssh} -p ".$port." $distantconnexion ".$data->{nagios_bin}." -v $cfg_dir/nagios.cfg";
     ($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd,
                                                           logger => $self->{logger},
                                                           timeout => 60
diff --git a/libinstall/functions b/libinstall/functions
index c9b1ec35ee67ba516645750d1df8393f5777dfa4..11ccf2978b12b887a6102bac24e1d1bc180ae471 100755
--- a/libinstall/functions
+++ b/libinstall/functions
@@ -1299,12 +1299,6 @@ function prepare_sudo_config() {
 	# Monitoring engine force-reload
 	CENTREON   ALL = NOPASSWD: $MONITORINGENGINE_INIT_SCRIPT* force-reload
 	CENTREON   ALL = NOPASSWD: $MONITORINGENGINE_INIT_SCRIPT force-reload
-	# Monitoring engine test config
-	CENTREON   ALL = NOPASSWD: $MONITORINGENGINE_BINARY* -v *
-	CENTREON   ALL = NOPASSWD: $MONITORINGENGINE_BINARY -v *
-	# Monitoring engine test for optim config
-	CENTREON   ALL = NOPASSWD: $MONITORINGENGINE_BINARY* -s *
-	CENTREON   ALL = NOPASSWD: $MONITORINGENGINE_BINARY -s *
 	# Snmptrapd Restart
 	CENTREON   ALL = NOPASSWD: $INIT_D/snmptrapd restart
 	# Centreontrapd restart
diff --git a/www/class/centreonAuth.class.php b/www/class/centreonAuth.class.php
index 4a06ff18fa95b0ce6f64b5b2ea8bbc1102f817b6..82e2f17668e44484a353f8f6da08f4629dfe9d1f 100644
--- a/www/class/centreonAuth.class.php
+++ b/www/class/centreonAuth.class.php
@@ -223,10 +223,11 @@ class CentreonAuth {
      * @return void
      */
     protected function checkUser($username, $password, $token) {
+        $usernameForQuery = $this->pearDB->escape($username, true);
         if ($this->autologin == 0 || ($this->autologin && $token != "")) {
-            $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE `contact_alias` = '" . htmlentities($username, ENT_QUOTES, "UTF-8") . "' AND `contact_activate` = '1' AND `contact_register` = '1' LIMIT 1");
+            $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE `contact_alias` = '" . $usernameForQuery . "' AND `contact_activate` = '1' AND `contact_register` = '1' LIMIT 1");
         } else {
-            $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE MD5(contact_alias) = '" . htmlentities($username, ENT_QUOTES, "UTF-8") . "' AND `contact_activate` = '1' AND `contact_register` = '1' LIMIT 1");
+            $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE MD5(contact_alias) = '" . $usernameForQuery . "' AND `contact_activate` = '1' AND `contact_register` = '1' LIMIT 1");
         }
         if ($DBRESULT->numRows()) {
             $this->userInfos = $DBRESULT->fetchRow();
@@ -264,7 +265,7 @@ class CentreonAuth {
             /*
              * Reset userInfos with imported informations
              */
-            $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE `contact_alias` = '" . htmlentities($username, ENT_QUOTES, "UTF-8") . "' AND `contact_activate` = '1' AND `contact_register` = '1' LIMIT 1");
+            $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE `contact_alias` = '" . $usernameForQuery . "' AND `contact_activate` = '1' AND `contact_register` = '1' LIMIT 1");
             if ($DBRESULT->numRows()) {
                 $this->userInfos = $DBRESULT->fetchRow();
             }
diff --git a/www/class/centreonLog.class.php b/www/class/centreonLog.class.php
index 68e784fb6aa539a61758909cccb5775cedb542eb..a4894987c98106c00a9cd6b9b052f0422ac670ff 100644
--- a/www/class/centreonLog.class.php
+++ b/www/class/centreonLog.class.php
@@ -100,9 +100,9 @@ class CentreonUserLog {
 		$string = str_replace("*", "\*", $string);
 
 		/*
-		 * print Error in log file.
+		 * Write Error in log file.
 		 */
-		exec("echo \"".$string."\" >> ".$this->errorType[$id]);
+        file_put_contents($this->errorType[$id], $string . "\n", FILE_APPEND);
 	}
 
 	public function setUID($uid)
@@ -174,9 +174,9 @@ class CentreonLog {
 
 
 		/*
-		 * print Error in log file.
+		 * Write Error in log file.
 		 */
-		exec("echo \"".$string."\" >> ".$this->errorType[$id]);
+        file_put_contents($this->errorType[$id], $string . "\n", FILE_APPEND);
 	}
 
 }
diff --git a/www/include/configuration/configGenerate/xml/generateFiles.php b/www/include/configuration/configGenerate/xml/generateFiles.php
index 88aa6a5627b5180218c73a6fbfcce2828a8df344..1fa79cc4a562ee9604fe033ace2c885a613d1e62 100644
--- a/www/include/configuration/configGenerate/xml/generateFiles.php
+++ b/www/include/configuration/configGenerate/xml/generateFiles.php
@@ -58,7 +58,7 @@ function printDebug($xml, $tabs)
         }
     }
     foreach ($tab_server as $host) {
-        $stdout = shell_exec("sudo ".$nagios_bin["nagios_bin"] . " -v ".$nagiosCFGPath.$host["id"]."/nagiosCFG.DEBUG 2>&1");
+        $stdout = shell_exec($nagios_bin["nagios_bin"] . " -v ".$nagiosCFGPath.$host["id"]."/nagiosCFG.DEBUG 2>&1");
         $stdout = htmlentities($stdout);
         $msg_debug[$host['id']] = str_replace ("\n", "<br />", $stdout);
         $msg_debug[$host['id']] = str_replace ("Warning:", "<font color='orange'>Warning</font>", $msg_debug[$host['id']]);
diff --git a/www/include/configuration/configOptimize/formOptimizeFiles.php b/www/include/configuration/configOptimize/formOptimizeFiles.php
index 7d5efc1f3c2bdf201e4153b15b8b764d9d2836e5..8951a9c117996c0f39d06a6251918b11d5205b68 100644
--- a/www/include/configuration/configOptimize/formOptimizeFiles.php
+++ b/www/include/configuration/configOptimize/formOptimizeFiles.php
@@ -111,7 +111,7 @@
 		$DBRESULT_Servers = $pearDB->query("SELECT `id` FROM `nagios_server` WHERE `ns_activate` = '1' ORDER BY `name`");
 		while ($tab = $DBRESULT_Servers->fetchRow()){
 			if (isset($ret["host"]) && ($ret["host"] == 0 || $ret["host"] == $tab['id'])){
-				$stdout = shell_exec("sudo ".$nagios_bin["nagios_bin"] . " -s ".$nagiosCFGPath.$tab['id']."/nagiosCFG.DEBUG");
+				$stdout = shell_exec($nagios_bin["nagios_bin"] . " -s ".$nagiosCFGPath.$tab['id']."/nagiosCFG.DEBUG");
 				$stdout = htmlentities($stdout, ENT_QUOTES, "UTF-8");
 				$msg_optimize[$tab['id']] = str_replace ("\n", "<br />", $stdout);
 				$cpt++;
@@ -137,4 +137,4 @@
 	$tpl->assign('form', $renderer->toArray());
 	$tpl->assign('o', $o);
 	$tpl->display("formOptimizeFiles.ihtml");
-?>
\ No newline at end of file
+?>