I know about shutdown -h now and shutdown -r now but you need to be root for this. I mean what are the commands use for this.
Shutdown
Restart
Suspend
Hibernate
What commands does this menu use?
I want to make desktop shortcuts. I do not want to have to use "gksudo" or "sudo".
OR What command does the "quit" item on the mint menu use to bring up the shutdown menu?
Thank you
shutdown form command without root.
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
shutdown form command without root.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: shutdown form command without root.
you could try these commands if they work. I cannot test it now because if it'd work I don't want to turn off my PC for now
http://www.computerhope.com/issues/ch000606.htm
http://www.computerhope.com/issues/ch000606.htm
Re: shutdown form command without root.
First in terminal do;
sudo chmod u+s /sbin/shutdown
Then you simply need to do
shutdown [options] now or time
sudo chmod u+s /sbin/shutdown
Then you simply need to do
shutdown [options] now or time
Re: shutdown form command without root.
To run a root command without having to type the password, you need to add that command to the sudoers file. to do that, first then add the lines where you need to replace USERNAME with the username of the account you want to be able to shutdown the computer.
To shut it down, you still need to do but you will not need to type in a password.
Be warned though, adding commands to the sudoers file essentially overwrites one of Linux's inherent safety features
EDIT: hemimaniac wrote his post as I was writing mine, I can see his method working just as well but though I'd leave my reply here just incase its useful to someone!
Code: Select all
sudo visudo
Code: Select all
USERNAME ALL = NOPASSWD: /sbin/shutdown
To shut it down, you still need to do
Code: Select all
sudo shutdown now
Be warned though, adding commands to the sudoers file essentially overwrites one of Linux's inherent safety features
EDIT: hemimaniac wrote his post as I was writing mine, I can see his method working just as well but though I'd leave my reply here just incase its useful to someone!
Re: shutdown form command without root.
I think the commands to suspend/hibernate are 'pm-suspend' and 'pm-hibernate'
chmod +s won't work on these because they're shell scripts, so follow beefstu's advice to run these commands without a password.
chmod +s won't work on these because they're shell scripts, so follow beefstu's advice to run these commands without a password.
Re: shutdown form command without root.
hemimaniac wrote:First in terminal do;
sudo chmod u+s /sbin/shutdown
Then you simply need to do
shutdown [options] now or time
This worked, thank you. Ok I can shutdown form desktop now, but is there a way to make the "quit" / shutdown menu open form shortcut. OR to have the shortcut open an "are you shore?" dialog box.