Advertisement

04.25.2008 at 07:17AM PDT, ID: 23353569
[x]
Attachment Details

Making an embedded Linux application running as an ordinary user account shutdown the system

Asked by sternocera in Linux, Linux Network Security, Shell Scripting

Hello,

I'm writing an embedded application on the Linux platform. It is designed to run without a window manager, and as the sole application that runs on the computer.  I would prefer have the program running as an ordinary user, in keeping with the Principle of least privilege.I also require the application to be able to shut-down the entire system. I guess the way to do this is to have it invoke some shell script.

Seemingly, root access is required in order to shut-down the system, or make whatever POSIX system call(s) are necessary to shut-down the system. Window managers are generally split into two or more processes, one of which runs as root to handle things like this. For example, in KDE, this is the kdm process.

My questions are:
1. What shell commands/series of commands will shut-down a Linux system that is maximally portable across Linux distributions/shells? I see my OpenSuse distro has /sbin/shutdown, /sbin/halt, etc. All of these require root access.
2. How can I shutdown the system without giving my application root access? It occurs to me that I could have a process running as root specifically to shutdown the system, with which my application can communicate with through some sort of Inter-process communication. I'd rather avoid such an elaborate solution, though.

Thanks a lot,
SternoceraStart Free Trial
 
Loading Advertisement...
 
[+][-]04.25.2008 at 09:03AM PDT, ID: 21440849

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.25.2008 at 12:07PM PDT, ID: 21442419

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Linux, Linux Network Security, Shell Scripting
Sign Up Now!
Solution Provided By: schmendric
Participating Experts: 3
Solution Grade: B
 
 
[+][-]04.25.2008 at 04:43PM PDT, ID: 21443884

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.29.2008 at 03:46AM PDT, ID: 21460998

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628