[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PPPD n VPNS: Preventing simultaneous logins



I used this script to killl the pppd for multiple login users.
Note I use pptpd with logwtmp so the users apear loged on when I use w command However there seems to be a bug that causes some times users to remain present in wtmp even if they are not connected.... maybe u have more luck


#interface-name peer-name user-name tty-device speed

dupfound=`w|grep "^$2\ "|gawk -F ' ' '{print $1}'|uniq -D|uniq`
if [ $dupfound == $2 ]
then
       #option A: kill curent user (not good since the use might be hanged)
       #kill `cat /var/run/$1.pid `
       #option B: kill all users with that name including this one
       for i in `w|grep "^$2\ "|gawk -F ' ' '{print $2}'`
          do  kill `cat /var/run/$i.pid`
       done

fi



Reply to: