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" <tzafrir.co...@xorcom.com> έγραψε:
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: ALLThis 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