ExecOnMcode + 3.4.6, sudo commands are not executed
-
Re: ExecOnMcode
Hello!
I'm using Duet3HC + SBC Raspberry Pi3
I deployed the Duet3-Lite image (v.3.4.6 from 09/06/2023, taken from https://github.com/Duet3D/DuetPi) to MicroSD, configured the network, and restored the configuration files of my printer.
Then I installed the ExecOnMcode plugin (ExecOnMcode-0.5.zip) in DWC exactly according to the instructions https://plugins.duet3d.com/plugins/DSF_ExecOnMcode_Plugin.html,
including creating the file /etc/sudoers.d/010_dsf-nopasswd and writing dsf ALL=(ALL) NOPASSWD: ALL in itRestarted Duet3HC+SBC
Launched the ExecOnMcode plugin in DWC
I edited the M1201 command and specified 'sudo reboot' in it
In the console DWC I executed commands M1200 and M1201 sequentially.
Raspberry did not restart.The lines appeared in the log:
Duet3 kernel: audit: type=1400 audit(1701354925.815:8):apparmor="DENIED" operation="capable" profile="/opt/dsf/plugins/ExecOnMcode/" pid=820 comm="sudo" capability=7 capname="setuid"
Duet3 kernel: audit: type=1400 audit(1701354925.815:9): apparmor="DENIED" operation="capable" profile="/opt/dsf/plugins/ExecOnMcode/" pid=820 comm="sudo" capability=6 capname="setgid"What should I do to be able to use the plugin to run "sudo reboot" and "sudo poweroff" with M-Code commands?
P.S. IMHO, it would be useful for many users if you added one more example to the two existing example commands that appear after installing the plugin: a command using sudo. For example, "sudo reboot".
-
@EagleB3 i'm going to ping @Falcounet as he should be able to help you.
Did you know you can reboot the pi anyway using the duetpimanagement plugin? https://github.com/Duet3D/DuetSoftwareFramework/blob/master/src/DuetPiManagementPlugin/README.md -
@jay_s_uk , many thanks! I didn't know about this possibility.
I tried it and it worked! -
@EagleB3 plugins including ExecOnMcode doesn't have the right (unless you change the DSF config) to use sudo commands. That's intended.
As Jay said, duetpimanagement plugin is the way to go for this. -
@Falcounet , thank you very much for your quick response! Please tell me what changes should be made to DSF config and how this can be done? Maybe there is a link to the description?
Is it possible to give the plugin the necessary rights by changing the manifest of the ExecOnMcode plugin before installing it in the DWC interface (https://github.com/Duet3D/DuetSoftwareFramework/blob/master/PLUGINS.md#list-of-permissions, "SuperUser" )?
P.S. I have extensive experience in IT, but practically no experience with *nix systems...