Topics

Network restart


Klaus Rung
 

I have this script working to restart the node and it is working very well.

# Reboot node via DTMF Code

if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi


My next question is how can I use the above to do a service network restart to just restart the network only?

Any ideas would be very welcome,

thanks in advance.

Klaus
ve3kr


k9dc
 

As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart). You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is. But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc

On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:

I have this script working to restart the node and it is working very well.

# Reboot node via DTMF Code

if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi


My next question is how can I use the above to do a service network restart to just restart the network only?

Any ideas would be very welcome,

thanks in advance.

Klaus
ve3kr


Klaus Rung
 

This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> I have this script working to restart the node and it is working very well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr







John Lorenc
 

Hi Klaus

Linux is case sensitive.

Change All to ALL.

John va3wm


On Apr 2, 2020, at 3:32 PM, Klaus Rung via groups.io <k_rung@...> wrote:


This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> I have this script working to restart the node and it is working very well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr







Klaus Rung
 

I missed the two upper case LL , but it still gives the same message

On Thursday, April 2, 2020, 3:45:52 p.m. EDT, John Lorenc <va3xjl@...> wrote:


Hi Klaus

Linux is case sensitive.

Change All to ALL.

John va3wm


On Apr 2, 2020, at 3:32 PM, Klaus Rung via groups.io <k_rung@...> wrote:


This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> I have this script working to restart the node and it is working very well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr







 

You dont put the command in the sudoers file.

Try;

repeater    ALL=(ALL:ALL) ALL


** Dave Parks **
IRLP Node: 8139
1-734-219-2010
Correspondent Amateur Radio Newsline



On Thursday, April 2, 2020, 3:56:21 PM EDT, Klaus Rung via groups.io <k_rung@...> wrote:


I missed the two upper case LL , but it still gives the same message

On Thursday, April 2, 2020, 3:45:52 p.m. EDT, John Lorenc <va3xjl@...> wrote:


Hi Klaus

Linux is case sensitive.

Change All to ALL.

John va3wm


On Apr 2, 2020, at 3:32 PM, Klaus Rung via groups.io <k_rung@...> wrote:


This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> I have this script working to restart the node and it is working very well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr







k9dc
 

Change the line in custom-decode to
if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi

and change the line in sudoers to
repeater All=NOPASSWD:/usr/sbin/service

(‘service’ is the actual command that must be authorized, the rest are modifiers)

Or if you want to allow ALL commands with sudo in front
repeater ALL=(ALL) NOPASSWD: ALL

This is handy if you want to modify a file with pico, as user repeater
sudo pico custom/environment

or look at something that requires root privs to read.

like ’sudo cat custom/rc.irlp’ or if you need to execute rc.irlp
sudo custom/rc.irlp (restarts IRLP)

Lots of uses, allowing you to stay logged in as user repeater, rather than su’ing to root and forgetting you are no longer repeater. IMO safer than working while logged in as root.

Various admins will have various opinions on doing that. But for me, since I am a Macintosh user, I am used to that procedure. Same procedure I use on my Mac, I use on my Linux machines.

-k9dc

On Apr 2, 2020, at 15:32, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:

This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater ALL=NOPASSWD:/sbin/reboot
repeater All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart). You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is. But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:

I have this script working to restart the node and it is working very well.

# Reboot node via DTMF Code

if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi


My next question is how can I use the above to do a service network restart to just restart the network only?

Any ideas would be very welcome,

thanks in advance.

Klaus
ve3kr






Klaus Rung
 

that still wants a password when I say            decode 22


On Thursday, April 2, 2020, 4:00:34 p.m. EDT, Dave Parks - WB8ODF via groups.io <wb8odf@...> wrote:


You dont put the command in the sudoers file.

Try;

repeater    ALL=(ALL:ALL) ALL


** Dave Parks **
IRLP Node: 8139
1-734-219-2010
Correspondent Amateur Radio Newsline



On Thursday, April 2, 2020, 3:56:21 PM EDT, Klaus Rung via groups.io <k_rung@...> wrote:


I missed the two upper case LL , but it still gives the same message

On Thursday, April 2, 2020, 3:45:52 p.m. EDT, John Lorenc <va3xjl@...> wrote:


Hi Klaus

Linux is case sensitive.

Change All to ALL.

John va3wm


On Apr 2, 2020, at 3:32 PM, Klaus Rung via groups.io <k_rung@...> wrote:


This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> I have this script working to restart the node and it is working very well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr







 

Try telling sudo you want to run just "service"

repeater    All=NOPASSWD:/usr/sbin/service


** Dave Parks **
IRLP Node: 8139
1-734-219-2010
Correspondent Amateur Radio Newsline



On Thursday, April 2, 2020, 4:06:28 PM EDT, Klaus Rung via groups.io <k_rung@...> wrote:


that still wants a password when I say            decode 22


On Thursday, April 2, 2020, 4:00:34 p.m. EDT, Dave Parks - WB8ODF via groups.io <wb8odf@...> wrote:


You dont put the command in the sudoers file.

Try;

repeater    ALL=(ALL:ALL) ALL


** Dave Parks **
IRLP Node: 8139
1-734-219-2010
Correspondent Amateur Radio Newsline



On Thursday, April 2, 2020, 3:56:21 PM EDT, Klaus Rung via groups.io <k_rung@...> wrote:


I missed the two upper case LL , but it still gives the same message

On Thursday, April 2, 2020, 3:45:52 p.m. EDT, John Lorenc <va3xjl@...> wrote:


Hi Klaus

Linux is case sensitive.

Change All to ALL.

John va3wm


On Apr 2, 2020, at 3:32 PM, Klaus Rung via groups.io <k_rung@...> wrote:


This is what I have in custom_decode

if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi

This is what I have in sudoers but when I run it it wants the passwd

repeater@stn2450:~/$ decode 22
[sudo] password for repeater:




# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart


Where have I gone wrong?



On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:



As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.

'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.

I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.

-k9dc


> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> I have this script working to restart the node and it is working very well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr







Klaus Rung
 

Ok it now works.

I used in sudoers

repeater     ALL=NOPASSWD:/usr/sbin/      

and in custom_decode

if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi



On Thursday, April 2, 2020, 4:01:45 p.m. EDT, k9dc <dave@...> wrote:



Change the line in custom-decode to
if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi

and change the line in sudoers to
repeater    All=NOPASSWD:/usr/sbin/service

(‘service’ is the actual command that must be authorized, the rest are modifiers)

Or if you want to allow ALL commands with sudo in front
repeater      ALL=(ALL)      NOPASSWD: ALL

This is handy if you want to modify a file with pico, as user repeater
sudo pico custom/environment

or look at something that requires root privs to read.

like ’sudo cat custom/rc.irlp’  or if you need to execute rc.irlp
sudo custom/rc.irlp  (restarts IRLP)

Lots of uses, allowing you to stay logged in as user repeater, rather than su’ing to root and forgetting you are no longer repeater. IMO safer than working while logged in as root.

Various admins will have various opinions on doing that. But for me, since I am a Macintosh user, I am used to that procedure. Same procedure I use on my Mac, I use on my Linux machines.

-k9dc


> On Apr 2, 2020, at 15:32, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> This is what I have in custom_decode
>
> if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi
>
> This is what I have in sudoers but when I run it it wants the passwd
>
> repeater@stn2450:~/$ decode 22
> [sudo] password for repeater:
>
>
>
>
> # User privilege specification
> root    ALL=(ALL:ALL) ALL
> # ADD THIS LINE TO ALLOW repeater USER TO REBOOT
> repeater    ALL=NOPASSWD:/sbin/reboot
> repeater    All=NOPASSWD:/usr/sbin/service network restart
>
>
> Where have I gone wrong?
>
>
>
> On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:
>
>
>
> As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.
>
> 'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.
>
> I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.
>
> -k9dc
>
>
> > On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
> >
> > I have this script working to restart the node and it is working very well.
> >
> > # Reboot node via DTMF Code
> >
> > if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
> >
> >
> > My next question is how can I use the above to do a service network restart to just restart the network only?
> >
> > Any ideas would be very welcome,
> >
> > thanks in advance.
> >
> > Klaus
> > ve3kr
>
>
>
>
>
>
>




 

Gr8, now you should understand how to deal with sudoers :)


** Dave Parks **
IRLP Node: 8139
1-734-219-2010
Correspondent Amateur Radio Newsline



On Thursday, April 2, 2020, 4:11:49 PM EDT, Klaus Rung via groups.io <k_rung@...> wrote:


Ok it now works.

I used in sudoers

repeater     ALL=NOPASSWD:/usr/sbin/      

and in custom_decode

if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi



On Thursday, April 2, 2020, 4:01:45 p.m. EDT, k9dc <dave@...> wrote:



Change the line in custom-decode to
if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi

and change the line in sudoers to
repeater    All=NOPASSWD:/usr/sbin/service

(‘service’ is the actual command that must be authorized, the rest are modifiers)

Or if you want to allow ALL commands with sudo in front
repeater      ALL=(ALL)      NOPASSWD: ALL

This is handy if you want to modify a file with pico, as user repeater
sudo pico custom/environment

or look at something that requires root privs to read.

like ’sudo cat custom/rc.irlp’  or if you need to execute rc.irlp
sudo custom/rc.irlp  (restarts IRLP)

Lots of uses, allowing you to stay logged in as user repeater, rather than su’ing to root and forgetting you are no longer repeater. IMO safer than working while logged in as root.

Various admins will have various opinions on doing that. But for me, since I am a Macintosh user, I am used to that procedure. Same procedure I use on my Mac, I use on my Linux machines.

-k9dc


> On Apr 2, 2020, at 15:32, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> This is what I have in custom_decode
>
> if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi
>
> This is what I have in sudoers but when I run it it wants the passwd
>
> repeater@stn2450:~/$ decode 22
> [sudo] password for repeater:
>
>
>
>
> # User privilege specification
> root    ALL=(ALL:ALL) ALL
> # ADD THIS LINE TO ALLOW repeater USER TO REBOOT
> repeater    ALL=NOPASSWD:/sbin/reboot
> repeater    All=NOPASSWD:/usr/sbin/service network restart
>
>
> Where have I gone wrong?
>
>
>
> On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:
>
>
>
> As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.
>
> 'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.
>
> I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.
>
> -k9dc
>
>
> > On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
> >
> > I have this script working to restart the node and it is working very well.
> >
> > # Reboot node via DTMF Code
> >
> > if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
> >
> >
> > My next question is how can I use the above to do a service network restart to just restart the network only?
> >
> > Any ideas would be very welcome,
> >
> > thanks in advance.
> >
> > Klaus
> > ve3kr
>
>
>
>
>
>
>




Klaus Rung
 

Yes, slowly catching on thanks to you guys.

Thanks for all the help.

On Thursday, April 2, 2020, 4:13:46 p.m. EDT, Dave Parks - WB8ODF via groups.io <wb8odf@...> wrote:


Gr8, now you should understand how to deal with sudoers :)


** Dave Parks **
IRLP Node: 8139
1-734-219-2010
Correspondent Amateur Radio Newsline



On Thursday, April 2, 2020, 4:11:49 PM EDT, Klaus Rung via groups.io <k_rung@...> wrote:


Ok it now works.

I used in sudoers

repeater     ALL=NOPASSWD:/usr/sbin/      

and in custom_decode

if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi



On Thursday, April 2, 2020, 4:01:45 p.m. EDT, k9dc <dave@...> wrote:



Change the line in custom-decode to
if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi

and change the line in sudoers to
repeater    All=NOPASSWD:/usr/sbin/service

(‘service’ is the actual command that must be authorized, the rest are modifiers)

Or if you want to allow ALL commands with sudo in front
repeater      ALL=(ALL)      NOPASSWD: ALL

This is handy if you want to modify a file with pico, as user repeater
sudo pico custom/environment

or look at something that requires root privs to read.

like ’sudo cat custom/rc.irlp’  or if you need to execute rc.irlp
sudo custom/rc.irlp  (restarts IRLP)

Lots of uses, allowing you to stay logged in as user repeater, rather than su’ing to root and forgetting you are no longer repeater. IMO safer than working while logged in as root.

Various admins will have various opinions on doing that. But for me, since I am a Macintosh user, I am used to that procedure. Same procedure I use on my Mac, I use on my Linux machines.

-k9dc


> On Apr 2, 2020, at 15:32, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
>
> This is what I have in custom_decode
>
> if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi
>
> This is what I have in sudoers but when I run it it wants the passwd
>
> repeater@stn2450:~/$ decode 22
> [sudo] password for repeater:
>
>
>
>
> # User privilege specification
> root    ALL=(ALL:ALL) ALL
> # ADD THIS LINE TO ALLOW repeater USER TO REBOOT
> repeater    ALL=NOPASSWD:/sbin/reboot
> repeater    All=NOPASSWD:/usr/sbin/service network restart
>
>
> Where have I gone wrong?
>
>
>
> On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:
>
>
>
> As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.
>
> 'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.
>
> I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.
>
> -k9dc
>
>
> > On Apr 2, 2020, at 13:45, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:
> >
> > I have this script working to restart the node and it is working very well.
> >
> > # Reboot node via DTMF Code
> >
> > if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
> >
> >
> > My next question is how can I use the above to do a service network restart to just restart the network only?
> >
> > Any ideas would be very welcome,
> >
> > thanks in advance.
> >
> > Klaus
> > ve3kr
>
>
>
>
>
>
>




k9dc
 

Klaus,
That is not what I said.

The sudoers line should be
repeater All=NOPASSWD:/usr/sbin/service

unless you want to allow any command with sudo, then set it to
repeater ALL=(ALL) NOPASSWD: ALL

On Apr 2, 2020, at 16:11, Klaus Rung via groups.io <k_rung=yahoo.com@groups.io> wrote:

Ok it now works.

I used in sudoers

repeater ALL=NOPASSWD:/usr/sbin/

and in custom_decode

if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi


David Cameron - IRLP
 

There should be no / before service.

if [ "$1" = "22" ] ; then sudo service networking restart ; exit 1 ; fi

Try it logged in as user repeater first. The command must work as the user if it is going to work in the custom_decode file.

Dave Cameron

On 2020-04-02 12:32 p.m., Klaus Rung via groups.io wrote:
This is what I have in custom_decode
if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi
This is what I have in sudoers but when I run it it wants the passwd
repeater@stn2450:~/$ decode 22
[sudo] password for repeater:
# User privilege specification
root    ALL=(ALL:ALL) ALL
# ADD THIS LINE TO ALLOW repeater USER TO REBOOT
repeater     ALL=NOPASSWD:/sbin/reboot
repeater     All=NOPASSWD:/usr/sbin/service network restart
Where have I gone wrong?
On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:
As long as /usr/sbin/service is allowed by your /etc/sudoers file it should work fine.
'service networking restart' is the command to use (not service network restart).  You could also include 'service openvpn restart’ if you are using IRLP VPN.
I usually setup sudoers to allow ALL commands, rather than individually listed commands. Some folks consider that to be a security risk, which I suppose it is.  But for me, convenience outweighs security. It’s not like I have a large group of users logging in to my nodes and breaking things.
-k9dc

> On Apr 2, 2020, at 13:45, Klaus Rung via groups.io
<k_rung=yahoo.com@groups.io <mailto:yahoo.com@groups.io>> wrote:
>
> I have this script working to restart the node and it is working very
well.
>
> # Reboot node via DTMF Code
>
> if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>
>
> My next question is how can I use the above to do a service network
restart to just restart the network only?
>
> Any ideas would be very welcome,
>
> thanks in advance.
>
> Klaus
> ve3kr


Klaus Rung
 

Ok got both changes made and it works, thanks


On Thursday, April 2, 2020, 4:57:26 p.m. EDT, David Cameron - IRLP <dcameron@...> wrote:


There should be no / before service.

if [ "$1" = "22" ] ; then sudo service networking restart ; exit 1 ; fi

Try it logged in as user repeater first. The command must work as the
user if it is going to work in the custom_decode file.

Dave Cameron


On 2020-04-02 12:32 p.m., Klaus Rung via groups.io wrote:
> This is what I have in custom_decode
>
> if [ "$1" = "22" ] ; then sudo /service networking restart ; exit 1 ; fi
>
> This is what I have in sudoers but when I run it it wants the passwd
>
> repeater@stn2450:~/$ decode 22
> [sudo] password for repeater:
>
>
>
>
> # User privilege specification
> root    ALL=(ALL:ALL) ALL
> # ADD THIS LINE TO ALLOW repeater USER TO REBOOT
> repeater     ALL=NOPASSWD:/sbin/reboot
> repeater     All=NOPASSWD:/usr/sbin/service network restart
>
>
> Where have I gone wrong?
>
>
>
> On Thursday, April 2, 2020, 2:02:59 p.m. EDT, k9dc <dave@...> wrote:
>
>
>
> As long as /usr/sbin/service is allowed by your /etc/sudoers file it
> should work fine.
>
> 'service networking restart' is the command to use (not service network
> restart).  You could also include 'service openvpn restart’ if you are
> using IRLP VPN.
>
> I usually setup sudoers to allow ALL commands, rather than individually
> listed commands. Some folks consider that to be a security risk, which I
> suppose it is.  But for me, convenience outweighs security. It’s not
> like I have a large group of users logging in to my nodes and breaking
> things.
>
> -k9dc
>
>
>  > On Apr 2, 2020, at 13:45, Klaus Rung via groups.io
> <k_rung=yahoo.com@groups.io <mailto:yahoo.com@groups.io>> wrote:
>  >
>  > I have this script working to restart the node and it is working very
> well.
>  >
>  > # Reboot node via DTMF Code
>  >
>  > if [ "$1" = "C22" ] ; then sudo /sbin/reboot ; exit 1 ; fi
>  >
>  >
>  > My next question is how can I use the above to do a service network
> restart to just restart the network only?
>  >
>  > Any ideas would be very welcome,
>  >
>  > thanks in advance.
>  >
>  > Klaus
>  > ve3kr
>
>
>
>
>
>
>



Kevin B
 

Hey,
Sorry if I missed the answer already but i didn't see it in here. 
I occasionally have issues with vpn. I either reboot or run service openvpn restart. Instead of the bellow what would I add into custom decode for this?
if [ "$1" = "22" ] ; then sudo /usr/sbin/service networking restart ; exit 1 ; fi

I guess I would also need to know what to put in sudo.

Kevin
VE6KEZ 
1485


Kevin B
 

Disregard. Im actually learning the whole linux thing haha. Just change networking to openvpn. Plus deal with sudo as mentioned above. Works perfectly!

73
VE6KEZ