Permalink
Browse files

Merge pull request #20 from DexterTheDragon/fix_kick_user

Change ps command to lsof for kick_user
  • Loading branch information...
2 parents 9fb5d79 + 2647b30 commit bae227a97621b1a11c709f02f8d54c26cd95d13f @zolrath committed Jan 25, 2013
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"

0 comments on commit bae227a

Please sign in to comment.