Get Currently connected Network Name?
Laptop with KUbuntu 6.10 running on it.
I have a laptop with SSHD running on it. The situation is that SSHD server is only used at home and should be turned off whenever I am connected to network at work/office (security restrictions out there). So, I need somehow to let my laptop start SSHD server only whenever I am at home and connected to home network of course administrated by myself.
One possible solution of given problem is to put simple BASH script in /etc/init.d/start_ssh.sh that would start SSHD server or not depending on currently connected NETWORK name. The only problem here is how to get that NETWORK name in BASH (Python/C++/(T)CSH)? Any Ideas?
P.S. I have found some interesting folders in /etc/network/ with names:
Maybe as a solution start_ssh.sh script should be put there which will be executed each time network is changed? What is their purpose?
Do you get a different address when you are at work?
ifconfig eth0 | grep inet will tell you your network address.
Then you could write some bash / sed / awk / python / whatever to decide whether to start sshd or not.
It might be as easy as:
The solution is simple as usual. iwconfig will give me Access Point which is unique and can be used in order to get idea where am I working at: Home or Office.
The only problem is how to get the same information for wired connections? Sometimes I am using my cable network card. Any ideas?
|All times are GMT -5. The time now is 05:20 PM.|