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.

I desire to suspend my Ubuntu 12.04 install with a bash script. The pm-suspend command will not prompt for a password when resumed. Is there a way to suspend my machine and have a password prompt when resumed via a bash command?

share|improve this question

3 Answers 3

Lock the screen before suspending.

gnome-screensaver-command -l && pm-suspend
share|improve this answer

I assume you already have it set to ask for a password after suspend in System Settings > Brightness and Lock?

share|improve this answer

The screen locking mechanism works from the user who is logged into the Unity session. The pm-suspend command need to be run as root. I simply need to have more privileges set regarding the pm-suspend command.

share|improve this answer
    
Then run the gnome-screensaver-command -l && sudo pm-suspend. See help.ubuntu.com/community/Sudoers on how to allow your user to run pm-suspend as root (with sudo), without requiring you to enter your password. –  geirha Jul 25 '12 at 8:27

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.