segunda-feira, 29 de abril de 2013

Shutting down or restarting using openbox (with chroot)

First, your user must be allowed to shut down the system. Do it editing /etc/sudoers (a glance at man should help). We don't focus the edition of sudoers here. Then, add to you rc.xml (making backup of it first, always):

<keybind key="C-A-Delete" chroot="true">
      <keybind key="r">
        <action name="Execute">
          <prompt>Reiniciar o sistema?</prompt>
          <execute>reboot</execute>
        </action>
      </keybind>
      <keybind key="x">
        <action name="Execute">
          <prompt>Desligar o sistema?</prompt>
          <execute>poweroff</execute>
        </action>
      </keybind>
      <keybind key="Escape">
        <action name="BreakChroot"/>
      </keybind>

Doing so, when pressing ctrl+alt+del you'll be sent into a chroot that allows you to press x or r, the first will prompt a message to shutdown the system and the other, to restart it. If "yes" is chosen, the magic's done. Hope you like the tip.

Nenhum comentário: