Re: [asterisk-users] restart system from extension
On Thursday 06 Apr 2017, Atux Atux wrote: > hi. i would like to be able to reboot the system from my extension. is that > possible? if yes, how? It's possible, with something this in extensions.conf; exten => 99,1,NoOp(Restarting server now) exten => 99,n,System(shutdown -r now) Then dial 99. NB this is UNTESTED, for obvious reasons! You probably do not want this extension to be in a context that anyone besides you can access. And if you are not running Asterisk as root, then you will need to write a C wrapper around the shutdown binary and make it setuid root. But just because it is possible, does not mean it is not a really, really terrible idea. The real question is, WHY are you wanting to be able to reboot your server from your extension? Because there is almost certainly a better way of achieving whatever it is that you are hoping to achieve. -- JM or AJS Note: Originating address only accepts e-mail from list! If replying off- list, change address to asterisk1list at earthshod dot co dot uk . -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] restart system from extension
Please don't top post. On Thu, Apr 06, 2017 at 08:16:34PM +0300, Atux Atux wrote: hi. i would like to be able to reboot the system from my extension. is that possible? if yes, how? Στις 6 Απρ 2017 8:25 μ.μ., ο χρήστης "Tzafrir Cohen"έγραψε: System('sudo /sbin/reboot') On Thu, 6 Apr 2017, Atux Atux wrote: Could you give some more details please? While there may be many ways, sudo is the most obvious. I'd suggest sticking with it and learning it before researching other methods if you find a use case that sudo can't handle. Sudo allows a user to run specific (or any) commands as another user. For example, allow the asterisk user to run a command as apache or root. This ability can be configured to run with or without a password. If you're running Asterisk as root, which you shouldn't do, you don't need sudo since root can do almost everything. If you're running Asterisk as asterisk, you can create a file named asterisk in /etc/sudoers.d/ that tells sudo what commands you want sudo to allow the user named asterisk, what user that command will be executed as, and if a password is needed. And more -- wade through 'man sudoers' for all the gory details. In it's simplest form, which is not the most secure, this file would look like: asterisk ALL=(ALL) NOPASSWD: ALL This means the user asterisk can run all commands as any user on any host without needing a password. Kind of scary, right? The best way to edit this file is with the 'visudo' command because it will help prevent you from creating an invalid file. This can be very important when you are editing your file (for your login) remotely. You should take the time to create a 'sudoers' file for the asterisk user that allows the single '/sbin/reboot' command. Do as I say, not as I've done :) -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST https://www.linkedin.com/in/steve-edwards-4244281-- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] restart system from extension
Could you give some more details please? Στις 6 Απρ 2017 8:25 μ.μ., ο χρήστης "Tzafrir Cohen" < tzafrir.co...@xorcom.com> έγραψε: > On Thu, Apr 06, 2017 at 08:16:34PM +0300, Atux Atux wrote: > > hi. i would like to be able to reboot the system from my extension. is > that > > possible? if yes, how? > > System('sudo /sbin/reboot') > > You need to allow that in a sudoers file, of course. This may or may not > be a good idea. > > There are a host of other methods to permit unplivilidged users / > processes to run do specific priviliged actions. > > -- >Tzafrir Cohen > +972-50-7952406 mailto:tzafrir.co...@xorcom.com > http://www.xorcom.com > > -- > _ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: >http://lists.digium.com/mailman/listinfo/asterisk-users > -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] restart system from extension
On Thu, Apr 06, 2017 at 08:16:34PM +0300, Atux Atux wrote: > hi. i would like to be able to reboot the system from my extension. is that > possible? if yes, how? System('sudo /sbin/reboot') You need to allow that in a sudoers file, of course. This may or may not be a good idea. There are a host of other methods to permit unplivilidged users / processes to run do specific priviliged actions. -- Tzafrir Cohen +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] restart system from extension
hi. i would like to be able to reboot the system from my extension. is that possible? if yes, how? -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users