Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Trying to use the SHUTDOWN command from Terminal.What is the SU password?

Hello,

I'm trying to use the Shutdown command from a terminal window, but when I do it says "NOT super-user. So then I enter "SU shutdown" and then I'm prompted to enter the su password. I have no idea what password this would be! I've tried my user password that I use to log in with, no go. I've tried the Administrator password, which I use when I'm making system changes. None I know of seem to work.'

Ideas? Is there a set Super User password?

Thanks

Jeff

1.82 Ghz Dual Core Mac Mini, Mac OS X (10.4.10)

Posted on Sep 1, 2010 6:57 PM

Reply
Question marked as Best reply

Posted on Sep 1, 2010 7:04 PM

Jeff Ingram wrote:
I'm trying to use the Shutdown command from a terminal window, but when I do it says "NOT super-user.


Use a shutdown command that starts like this

sudo shutdown (and other parameters)

then enter the password of the administrative account that you're using.
14 replies

Sep 2, 2010 12:08 AM in response to William-Boyd-Jr

Thanks for the tip, but when I enter what you had suggested, "sudo shutdown", I get "ingramje is not in the sudoers file. This incident will be reported" ingramje is the username."

The whole reason why I'm interested in knowing how to do this is because I've been in the situation where my mouse battery would die and I wouldn't be able to shutdown/restart the system. Some reason after I've replaced the battery it still won't work until after I've restarted. I can open terminal by searching spotlight (Command + Spacebar, type terminal+enter).

Thanks for your help!

Jeff Ingram

Sep 2, 2010 12:29 AM in response to WZZZ

Ok I found this note and what he offers works!

02-20-2006, 06:14 PM #4
giskard22
Moderator

Join Date: May 2003
Posts: 4,254
You can modify these settings from the command line using 'pmset'. Using cron, you could make simple jobs that first use pmset to schedule the next startup, then execute a shutdown.

As hayne said, the 'shutdown' command will not give any GUI processes an opportunity to save files and whatnot. If you want a more graceful method, I believe you could use AppleScript from the command line to send an apple event instead. It would be like selecting "Shutdown" from the Apple menu:

osascript -e 'tell application "System Events"' -e 'shut down' -e 'end tell'

If any applications have unsaved work, the shutdown would halt.


So I've entered osascript -e 'tell application "System Events"' -e 'shut down' -e 'end tell' into a terminal window and pressed enter and it safely shutdown my system. Now for the next question, is there a way that I could save this to a file of some sort and just have it as an icon that I can double click to run this script?

Thanks sooo much for your help!

Jeff

Sep 2, 2010 6:19 AM in response to Jeff Ingram

Thanks for the tip, but when I enter what you had suggested, "sudo shutdown", I get "ingramje is not in the sudoers file. This incident will be reported" ingramje is the username."

Then 'ingramje' is not an administrator. You can make 'ingramje' an admin via System Preferences -> Accounts, however, if you intentionally have 'ingramje' setup so that account does not have admin rights, then the other approaches would be better.

You could also try

su whatever_account_does_have_adminrights -c "reboot"

Trying to use the SHUTDOWN command from Terminal.What is the SU password?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.