Re-2: [Samba] limit login

Cybionet cybionet at videotron.ca
Thu Sep 6 10:09:18 GMT 2007


Greeting Pascal,

Here a code I have made yesterday. It's surely not a great piece of 
code, but it's work with Windows client.

First in the netlogon section of your smb.conf, add the line:

root preexec = /pathof the scripts/test.sh %u %m

I don't have try this script with the log  level with another value than 
0. ( log level = 0 passdb:4 auth:4 vfs:2). The result of smbstatus was 
different. Create now a script named test.sh. A error I can see is the 
out.txt if multiple user log in the same tome. Maybe change this by %u.txt.

-BEGIN----------------------
#! /bin/bash

username=$1
machine=$2

if `smbstatus -Sp | grep "${username}" | grep -v "${machine}" 
1>/dev/null 2>&1`
 then
   #echo "Deja connecte"
   smbstatus -Sp | grep "${machine}" 1>/dev/null 2>&1 >out.txt
   PID =`gawk -F: '{ print $1 }' out.txt | cut -d " " -f1`
   kill $PID
  else
   #echo "Nouvelle connexion"
   exit 0
fi
-END----------------------------------

au plaisir,

Robert

-- 
Cybionet - Solution reseautique
http://www.cybionet.com



More information about the samba mailing list