Sapiens Search

How to prompt for a password when running a command or script?

kdesudo "<Full command>"

Example

1 - Open the run command with Alt+F2
2 - To reboot (needs root), for example, type:
kdesudo "shutdown -r now"
3- Type your root password and hit Return
4 - Your system will reboot after this

 Arcam Sapientia

You can use this on scripts to prompt for a pass when it is needed.

#!/bin/sh
clementine
kdesudo "shutdown -r 00:00"

This will open the clementine music player and reboot at 00:00 time.

No comments:

Post a Comment