Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change ps command to lsof for kick_user

  • Loading branch information...
commit 2647b302384ce1cc1f7eb992d11b956231848730 1 parent 9fb5d79
@DexterTheDragon DexterTheDragon authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 wemux
View
4 wemux
@@ -311,9 +311,9 @@ host_mode() {
kick_user() {
if [ "$allow_kick_user" == "true" ]; then
kicked_user=$1
- # Get sshd process with users name and get its PID.
- user_pid=`ps aux | grep "$kicked_user.*sshd" | grep -v grep | tr -s ' ' | cut -d ' ' -f 2`
echo "Kicking $kicked_user from the server. Sudo required."
+ # Get sshd process with users name and get its PID.
+ user_pid=`sudo lsof -t -u $kicked_user -c sshd -a`
# Kill the sshd process of the supplied user.
redirect=`sudo kill -9 $user_pid 2>&1`; kicked_successfully=$?
# Remove any tmux sessions ending in "-kicked_user"
Please sign in to comment.
Something went wrong with that request. Please try again.