小智 5
默认情况下,在Linux中启用PPTP多重登录.要禁用多重登录,我只需将下一行添加到/ etc/ppp/ip-up
# disconnect new PPTP connection if user already connected
sleep 2
PID=$(cat /var/run/$PPP_IFACE.pid)
if [ $PID ]; then
PROCCESS="$(last -w | grep ppp | grep still | grep $PPP_IFACE)"
USERNAME=$(echo $PROCCESS | cut -d' ' -f1)
NUMLOGINS="$(last -w | grep ppp | grep still | grep -c $USERNAME' ')"
if [ $NUMLOGINS -gt 1 ]; then
kill $PID
fi
fi
Run Code Online (Sandbox Code Playgroud)
如果用户登录,这部分只会断开任何新连接.在我的Ubuntu 9.04上正常工作