<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=7078&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] sudoers.d file for ifup / ifdown]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=7078</link>
		<description><![CDATA[The most recent posts in [SOLVED] sudoers.d file for ifup / ifdown.]]></description>
		<lastBuildDate>Thu, 20 Feb 2025 16:56:25 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] sudoers.d file for ifup / ifdown]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=54558#p54558</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>fsmithred wrote:</cite><blockquote><div><p>... log out and log in ...</p></div></blockquote></div><p>Of course ...&#160; 8^)</p><div class="quotebox"><cite>fsmithred wrote:</cite><blockquote><div><p>I use commas ...</p></div></blockquote></div><p>You and everyone else knowing how to do this properly.</p><p>Solved.<br />It was the lack of a <span class="bbc">comma</span> between the commands.</p><div class="codebox"><pre><code># cat /etc/sudoers.d/user_eth0
groucho ALL=(ALL) NOPASSWD: /sbin/ifup eth0, /sbin/ifdown eth0
# </code></pre></div><div class="codebox"><pre><code>~$ sudo ifdown eth0
Killed old client process
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:14:4f:4a:a2:81
Sending on   LPF/eth0/00:14:4f:4a:a2:81
Sending on   Socket/fallback
DHCPRELEASE of 192.168.1.10 on eth0 to 192.168.1.1 port 67</code></pre></div><div class="codebox"><pre><code>~$ sudo ifup eth0
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:14:4f:4a:a2:81
Sending on   LPF/eth0/00:14:4f:4a:a2:81
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPOFFER of 192.168.1.10 from 192.168.1.1
DHCPREQUEST for 192.168.1.10 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.1.10 from 192.168.1.1
/sbin/dhclient-script: 88: cannot create /etc/resolv.conf: Operation not permitted
bound to 192.168.1.10 -- renewal in 13983 seconds.
~$ </code></pre></div><p>So much then for <span class="bbc">visudo -c</span> ...&#160; 8^° <br />After all, it <span class="bbu">is</span> a syntax error.</p><p>Thank you very much for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Thu, 20 Feb 2025 16:56:25 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=54558#p54558</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] sudoers.d file for ifup / ifdown]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=54557#p54557</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>rolfie wrote:</cite><blockquote><div><p>Give that ...</p></div></blockquote></div><p>Nope, no dice.</p><div class="codebox"><pre><code># cat /etc/sudoers.d/user_eth0
groucho ALL=(root) NOPASSWD: /sbin/ifup eth0  /sbin/ifdown eth0
# </code></pre></div><div class="codebox"><pre><code>~$ sudo ifdown eth0
--- snip ---
Sorry, user groucho is not allowed to execute &#039;/sbin/ifdown eth0&#039; as root on localhost.
~$ </code></pre></div><div class="codebox"><pre><code>~$ sudo ifup eth0
--- snip ---
Sorry, user groucho is not allowed to execute &#039;/sbin/ifup eth0&#039; as root on localhost.
~$ </code></pre></div><p><span class="bbu">BTW</span>: found this -&gt; <a href="https://hackliza.gal/en/posts/cambiar_dns_linux/" rel="nofollow">https://hackliza.gal/en/posts/cambiar_dns_linux/</a> to chew on<br />Never saw it before, probably because I was looking for <span class="bbc">/etc/resolv.conf</span> in relation to <span class="bbc">connman</span> or <span class="bbc">network-manager</span>.</p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Thu, 20 Feb 2025 16:41:28 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=54557#p54557</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] sudoers.d file for ifup / ifdown]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=54556#p54556</link>
			<description><![CDATA[<p>couple guesses -</p><p>You need to log out and log in for the changes to take effect. (or restart sudo)</p><p>I use commas between things in the list, but I also use command aliases.</p><div class="codebox"><pre><code>Cmnd_Alias      HALT = /sbin/shutdown, /sbin/halt, /sbin/poweroff, /usr/sbin/pm-suspend, /usr/sbin/pm-hibernate
Cmnd_Alias      REBOOT = /sbin/reboot, /usr/local/bin/update-machineid
Cmnd_Alias      NET = /sbin/ifconfig, /sbin/ifup, /sbin/ifdown

fsmithred  ALL=NOPASSWD: HALT, REBOOT, NET</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Thu, 20 Feb 2025 16:40:02 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=54556#p54556</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] sudoers.d file for ifup / ifdown]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=54555#p54555</link>
			<description><![CDATA[<p>Give that a try: </p><div class="codebox"><pre><code>groucho ALL=(root) NOPASSWD: /sbin/ifup eth0  /sbin/ifdown eth0</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (rolfie)]]></author>
			<pubDate>Thu, 20 Feb 2025 16:04:25 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=54555#p54555</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] sudoers.d file for ifup / ifdown]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=54552#p54552</link>
			<description><![CDATA[<p>Hello:</p><p>Finally got fed up and decided to ditch <span class="bbc">connman</span> and as there is no <span class="bbc">WiCD</span> for the foreseable future (if there is such a thing), went for the time proven <span class="bbc">ifup</span> / <span class="bbc">ifdown</span> solution.</p><p>One less layer of abstraction or so it is said, can&#039;t be a bad thing.</p><p>To test things out, I disabled <span class="bbc">connman</span>, checked all settings and verified that <span class="bbc">ifup eth0</span> and <span class="bbc">ifdown eth0</span> (as root) worked properly.<br />My cable connection comes up at boot time as expected.</p><p>But at one point I realised that, in spite of what my <span class="bbc">/etc/resolv.conf</span> file read, I was back at my ISPs cable provider&#039;s DNS, so I ran <span class="bbc">chattr +i /etc/resolv.conf</span> and that was it. Evidently ditching <span class="bbc">connman</span> was not the solution.</p><p>And (by chance) I was actually able to verify it:</p><p>1. take down the connection:</p><div class="codebox"><pre class="vscroll"><code># /sbin/ifdown eth0
Killed old client process
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:14:4f:4a:a2:81
Sending on   LPF/eth0/00:14:4f:4a:a2:81
Sending on   Socket/fallback
DHCPRELEASE of 192.168.1.10 on eth0 to 192.168.1.1 port 67
# 
[code]

2. bring up the connection:

[/code]
# /sbin/ifup eth0
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:14:4f:4a:a2:81
Sending on   LPF/eth0/00:14:4f:4a:a2:81
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPOFFER of 192.168.1.10 from 192.168.1.1
DHCPREQUEST for 192.168.1.10 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.1.10 from 192.168.1.1

/sbin/dhclient-script: 88: cannot create /etc/resolv.conf: Operation not permitted  ### WTHF is *this*?

bound to 192.168.1.10 -- renewal in 12402 seconds.
# </code></pre></div><p>Obviously, <span class="bbc">chattr +i /etc/resolv.conf</span> was working properly.</p><p>I then opened up <span class="bbc">/sbin/dhclient-script</span> to have a look.<br />Not in any way script savvy but this part of it immediately called my attention:</p><p>--- snip ---<br /># update /etc/resolv.conf based on received values&#160; &#160; &#160;&lt;---- #######?<br />&#160; make_resolv_conf() {<br />&#160; &#160; &#160; local new_resolv_conf<br />--- snip ---</p><p>According to <span class="bbc">jed</span>, the whole snippet would be from line 39 to line 125 and it would seem (?) to be the routine that constantly overwrites <span class="bbc">/etc/resolv.conf</span>.</p><p>Anyone have an idea on this?<br />I thought that disabling the <span class="bbc">connman</span> service would be a solution but ...</p><p>But I digress ...<br />In order to avoid having to bring down the connection without being root, I made a file in <span class="bbc">/etc/sudoers.d</span>:</p><div class="codebox"><pre><code># cat /etc/sudoers.d/user_eth0
groucho ALL=(ALL) NOPASSWD: /sbin/ifup eth0  /sbin/ifdown eth0
#</code></pre></div><p>But it does not work and I don&#039;t understand why.</p><div class="codebox"><pre><code>~$ sudo ifup
--- snip ---
Sorry, user groucho is not allowed to execute &#039;/sbin/ifup&#039; as root on localhost.
~$
~$ sudo ifdown
--- snip ---
Sorry, user groucho is not allowed to execute &#039;/sbin/ifdown&#039; as root on localhost.
~$</code></pre></div><p>The file syntax is correct:</p><div class="codebox"><pre><code># visudo -c
--- snip ---
/etc/sudoers.d/user_eth0: parsed OK
--- snip ---
#</code></pre></div><p>I then checked and saw that <span class="bbc">/sbin/ifup</span> is a (dynamically linked) executable and that <span class="bbc">/sbin/ifdown</span> is a symbolic link to <span class="bbc">/sbin/ifup</span> but I have no idea how to get around that.</p><p>That said, I&#039;d appreciate pointers on how to get the <span class="bbc">/etc/sudoers.d</span> file working.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Thu, 20 Feb 2025 13:31:15 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=54552#p54552</guid>
		</item>
	</channel>
</rss>
