Re: Using NetworkManager in shell script



On Saturday 26 of March 2011 09:13:37 Aniket Oak wrote:
> Hi,
> 
> I have a problem again. I can connect by cnetworkmanager but I dont know
> how to disconnect.
> 
> I tried
> 
> *[aniket cnetworkmanager-0.21.1]$ ./cnetworkmanager --online=false*
> 
> *gives following error*
> 
> *Traceback (most recent call last):
>   File "./cnetworkmanager", line 119, in <module>
>     nm.Sleep(not options.online in true_choices)
>   File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 140, in
> __call__
>     **keywords)
>   File "/usr/lib/python2.6/site-packages/dbus/connection.py", line 630, in
> call_blocking
>     message, timeout)
> dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
> Rejected send message, 9 matched rules; type="method_call", sender=":1.116"
> (uid=500 pid=2932 comm="/usr/bin/python)
> interface="org.freedesktop.NetworkManager" member="Sleep" error
> name="(unset)" requested_reply=0 destination=":1.101" (uid=0 pid=2707
> comm="NetworkManager))
> [aniket cnetworkmanager-0.21.1]$ *
> 
> is there any way to disconnect?
> 

NetworkManager provides its own command-line tool - nmcli. You can use it for 
most of controlling stuff on the command line.

Deactivating a connection:
nmcli con down id "your connetcion name"

or disconnecting an interface:
nmcli dev disconnect iface wlan0

Info:
* man nmcli
* Comparison of cnetworkmanager x nmcli commands:
 http://repo.or.cz/w/cnetworkmanager.git/blob_plain/HEAD:/nmcli-migration.html

Jirka


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