I'm trying to set up Samba configuration in "/etc/samba/smb.conf" on Debian to make it work only when I'm at home (connected to a certain connection).
I don't want to share my folder when I'm not connected to my home router, because I often use my laptop with public/corporation wifi.
Any configuration suggested?
I think I found the solution adding a script at startup (/etc/init.d folder), made in this way:
#!/bin/bash
sleep 10s
wifi="'$(/sbin/iwconfig wlan0 | egrep ESSID | cut -d '"' -f 2)'"
if [ $wifi = "'NAME OF MY HOME WIRELESS CONNECTION'" ]
then
service smbd start
service nmbd start
else
service smbd stop
service nmbd stop
fi
Any advice is welcome.