Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

First of all sorry if my english is not excelent but it isnt my native language.

I have a project where I'm building my own shell (named MYSHELL). One of the tasks is to create my own built-in turnitoff, a command that can be executed by any user that has MYSHELL as default shell *. The problem is that this command is only for the sudo. I read that I can edit the sudoers file BUT there is a problem with this: Lets say that John has MYSHELL installed. He can change to his previous shell whenever he wants (for example bash). When he is in bash he is not supossed to run shutdown, but he will. Hope I made my self clear.... I dont want the answer, just a helping hand that can tell my were I can search... Thanx a lot in advance! NOTE: all the code is in BASH no bin files allowed

*The user that has MYSHELL as shell is because someone installed it with a makefile. At this point is when we can change everything becase the makefile is run with the root user.

share|improve this question

1 Answer 1

On a system which has DBus and ConsoleKit installed you can use the following command to shut down the system without super-admin privileges (i.e. without granting sudo rights to the user):

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.