07-12-2016 07:39 AM
Hello;
I want to put a button in the panel of the embedded UI to allow the user to reboot the system.
I Get restart from the command line as an administrator, but want the lvuser could reboot the system with a button on the panel.
I'm able to reboot the cRIO using the shell as administratos, but I want th lvuser coul reboot the system with a button on the panel.
Is there any way to do it?
Thanks
Solved! Go to Solution.
07-12-2016 09:56 AM
What version of the software stack are you using (from MAX's "Operating System" entry or by running the command "uname -a", both while the target has software installed)?
I think the issue you're running into is that the "reboot" command is not on a normal user's path, you need to call out a direct path to /sbin/reboot. This is a symlink to a symlink to a binary (/sbin/reboot -> /sbin/reboot.sysvinit -> /sbin/halt.sysvinit).
The binary that it eventually points to has a special permission bit set: the setuid bit. This special bit tells the kernel to look at the ownership of the file and use that for the capabilities for running the binary (e.g. run the binary as if the owner of the binary file is running the binary). This binary is owned by admin/root.
I did a quick check on a target sitting on my desk by using the su command to become the lvuser user, calling /sbin/reboot directly, and it works as expected. I am not really in a convenient place to check if calling the same binary from LV works as well, but if not you should report that.
07-12-2016 10:27 AM
07-12-2016 10:46 AM
Hi anderg,
There's also a restart VI that should work as well, you just have to pass in a session:
07-12-2016 11:15 AM
SAL9000,
I blame my answer on a lack of coffee. It did directly answer the question, but is not the best answer.
andberg,
I certainly recommend using the actual LV functionality, not the SystemExec calling the function, as I suggested.
07-17-2019 06:57 AM
Is there an easy way to call this from the Xfce desktop (maybe a link to a batch file or similar) or menu or taskbar?
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )
07-17-2019 10:33 AM
Hey joerg.hampel,
I did a quick test and you can create a file that calls /sbin/reboot and call it from a launcher on the XFCE desktop.
For example, I created a file /home/lvuser/restart with the following.
#!/bin/bash
/sbin/reboot
Then, I called the file restart from a launcher after creating a new panel on the desktop. This worked and rebooted the target.
Thanks,
Andy
PSE