On 11/19/2014 02:31 PM, John Jason Jordan wrote:
> I want to disconnect and later reconnect eth1* in a bash script. "Sudo
> ifconfig eth1 down" and then later "...up" will do it, but every time I
> run the script I will have to pump in my password. However, I can
> connect and disconnect from eth1 via the nm-applet GUI (using the panel
> icon) without needing root, so it should be possible to do so from the
> command line without sudo as well. Google has not been forthcoming with
> a non-sudo command to do this. Any ideas?
>
> *The ethernet chip on my System76 Bonobo Extreme has two MAC addresses,
> so Xubuntu 14.04.1 assigns eth0 to one and eth1 to the other. It always
> connects to eth1. Why this is so is beyond my job description, so I
> ignore the situation.
I don't have any input on why one works the way you want and one does
not beyond "that's how the tool works" which is less than helpful for you.
The good news is that you can resolve the issue by modifying your
sudoers file to not require a password for the ifconfig command.
Using the visudo command, you can follow this template I have:
Cmnd_Alias NETWORK = /sbin/ifconfig, /usr/sbin/wpa_gui, \
/sbin/dhclient, \
/etc/init.d/networking, /usr/sbin/iftop
dafr ALL=PASSWD: ALL, NOPASSWD:NETWORK,TOOLS,PMTOOLS
There may be other ways to accomplish this, but this works for me to
script various things and not have to be bothered with a password.
In your follow-up email, you pointed to something that sounds like
routing issues, but without more information it would be hard to verify
that, and pointless if you can use this as a solution and don't require
both interfaces up at the same time.
Because you asked, however, I would suggest you take a look at 'man 5
interfaces' and dig through there. It may be possible to accomplish what
you want by configuring the interface with additional parameters.
dafr
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug