From cc1d576124a8350abfae7787b82f1b565f720e87 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Tue, 19 Feb 2013 10:30:13 -0500
Subject: [PATCH] - Fixed FS#2655 - usermod fails with "user xyz is currently logged in".
---
server/plugins-available/shelluser_base_plugin.inc.php | 2 +-
server/plugins-available/shelluser_jailkit_plugin.inc.php | 8 ++++----
server/plugins-available/apache2_plugin.inc.php | 4 ++--
interface/web/login/lib/lang/de.lng | 2 +-
server/plugins-available/cron_jailkit_plugin.inc.php | 10 +++++-----
server/plugins-available/nginx_plugin.inc.php | 6 ++----
server/scripts/create_jailkit_user.sh | 4 ++--
7 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/interface/web/login/lib/lang/de.lng b/interface/web/login/lib/lang/de.lng
index 86e22d5..9d04a31 100644
--- a/interface/web/login/lib/lang/de.lng
+++ b/interface/web/login/lib/lang/de.lng
@@ -7,7 +7,7 @@
$wb['pw_reset'] = 'Das Passwort wurde zurückgesetzt und wird per E-Mail an Sie geschickt.';
$wb['pw_error'] = 'Benutzername oder E-Mail Adresse stimmen nicht überein.';
$wb['pw_error_noinput'] = 'Bitte geben Sie Ihre E-Mail Adresse und Ihren Benutzernamen ein.';
-$wb['pw_reset_mail_msg'] = 'Das Passwort wurde zurückgesetzt. Das neue Passwort lautet :';
+$wb['pw_reset_mail_msg'] = 'Das Passwort wurde zurückgesetzt. Das neue Passwort lautet: ';
$wb['pw_reset_mail_title'] = 'Ihr Passwort wurde zurückgesetzt.';
$wb['user_regex_error'] = 'Benutzername beinhaltet nicht erlaubte Zeichen oder ist länger als 64 Zeichen.';
$wb['pw_error_length'] = 'Die Passwortlänge ist > 64 Zeichen.';
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 1b424d3..ec8ac46 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -465,7 +465,7 @@
$command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' && usermod';
$command .= ' --home '.escapeshellcmd($data['new']['document_root']);
$command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
- $command .= ' '.escapeshellcmd($data['new']['system_user']);
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
exec($command);
}
@@ -701,7 +701,7 @@
if($web_config['add_web_users_to_sshusers_group'] == 'y') {
$command = 'usermod';
$command .= ' --groups sshusers';
- $command .= ' '.escapeshellcmd($data['new']['system_user']);
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
$this->_exec($command);
}
diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php
index 8df854a..963d71e 100644
--- a/server/plugins-available/cron_jailkit_plugin.inc.php
+++ b/server/plugins-available/cron_jailkit_plugin.inc.php
@@ -124,7 +124,7 @@
$this->_add_jailkit_user();
- $command .= 'usermod -U '.escapeshellcmd($parent_domain["system_user"]);
+ $command .= 'usermod -U '.escapeshellcmd($parent_domain["system_user"]).' 2>/dev/null';
exec($command);
$this->_update_website_security_level();
@@ -223,7 +223,7 @@
$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
- exec($command);
+ exec($command.' 2>/dev/null');
$this->app->log("Added jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
@@ -268,14 +268,14 @@
$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\'';
- exec($command);
+ exec($command.' 2>/dev/null');
$this->app->log("Added programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
$command .= ' \''.$this->jailkit_config['jailkit_chroot_cron_programs'].'\'';
- exec($command);
+ exec($command.' 2>/dev/null');
$this->app->log("Added cron programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
}
@@ -299,7 +299,7 @@
$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
$command .= ' '.$jailkit_chroot_userhome;
$command .= ' '.escapeshellcmd("/bin/bash");
- exec($command);
+ exec($command.' 2>/dev/null');
$this->app->log("Added jailkit user to chroot with command: ".$command,LOGLEVEL_DEBUG);
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 73fc849..1a593aa 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -469,7 +469,7 @@
$command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' && usermod';
$command .= ' --home '.escapeshellcmd($data['new']['document_root']);
$command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
- $command .= ' '.escapeshellcmd($data['new']['system_user']);
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
exec($command);
}
@@ -705,7 +705,7 @@
if($web_config['add_web_users_to_sshusers_group'] == 'y') {
$command = 'usermod';
$command .= ' --groups sshusers';
- $command .= ' '.escapeshellcmd($data['new']['system_user']);
+ $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
$this->_exec($command);
}
@@ -1666,8 +1666,6 @@
}
}
}
-
-
}
if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
$log_folders = array();
diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index 6b4e18f..c3133a6 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -114,7 +114,7 @@
//* Disable shell user temporarily if we use jailkit
if($data['new']['chroot'] == 'jailkit') {
- $command = 'usermod -s /bin/false -L '.escapeshellcmd($data['new']['username']);
+ $command = 'usermod -s /bin/false -L '.escapeshellcmd($data['new']['username']).' 2>/dev/null';
exec($command);
$app->log("Disabling shelluser temporarily: ".$command,LOGLEVEL_DEBUG);
}
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index b0a457d..268df9c 100755
--- a/server/plugins-available/shelluser_jailkit_plugin.inc.php
+++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -104,7 +104,7 @@
$app->system->usermod($data['new']['username'], 0, 0, '', '/usr/sbin/jk_chrootsh', '', '');
//* Unlock user
- $command = 'usermod -U '.escapeshellcmd($data['new']['username']);
+ $command = 'usermod -U '.escapeshellcmd($data['new']['username']).' 2>/dev/null';
exec($command);
$this->_update_website_security_level();
@@ -212,7 +212,7 @@
$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
$command .= ' '.escapeshellcmd($this->data['new']['dir']);
$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
- exec($command);
+ exec($command.' 2>/dev/null');
$this->app->log("Added jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
@@ -258,7 +258,7 @@
$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
$command .= ' '.escapeshellcmd($this->data['new']['dir']);
$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\'';
- exec($command);
+ exec($command.' 2>/dev/null');
$this->app->log("Added programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
}
@@ -290,7 +290,7 @@
$command .= ' '.escapeshellcmd($this->data['new']['shell']);
$command .= ' '.$this->data['new']['puser'];
$command .= ' '.$jailkit_chroot_puserhome;
- exec($command);
+ exec($command.' 2>/dev/null');
//* Change the homedir of the shell user and parent user
//* We have to do this manually as the usermod command fails
diff --git a/server/scripts/create_jailkit_user.sh b/server/scripts/create_jailkit_user.sh
index efe0603..da01f9a 100755
--- a/server/scripts/create_jailkit_user.sh
+++ b/server/scripts/create_jailkit_user.sh
@@ -25,9 +25,9 @@
jk_jailuser -n -s $CHROOT_SHELL -j $CHROOT_HOMEDIR $CHROOT_USERNAME
### Reconfigure the chroot home directory for the user ###
-usermod --home=$CHROOT_HOMEDIR/.$CHROOT_USERHOMEDIR $CHROOT_USERNAME
+usermod --home=$CHROOT_HOMEDIR/.$CHROOT_USERHOMEDIR $CHROOT_USERNAME 2>/dev/null
### We have to reconfigure the chroot home directory for the parent user ###
if [ "$CHROOT_P_USER" != "" ]; then
- usermod --home=$CHROOT_HOMEDIR/.$CHROOT_P_USER_HOMEDIR $CHROOT_P_USER
+ usermod --home=$CHROOT_HOMEDIR/.$CHROOT_P_USER_HOMEDIR $CHROOT_P_USER 2>/dev/null
fi
\ No newline at end of file
--
Gitblit v1.9.1