![]() ![]() Hibernate: (if enabled on your system) /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/UPower. Next, weâll add this line at the end of the file: ALL (ALL) ALL.Suspend: /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/UPower To do so you need to edit the /etc/sudoers sudo configuration command using the sudo visudo editor. This will open up an editor on the command line. Restart: /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/ConsoleKit/Manager .RestartĬonsolekit should of course be installed your system. Shutdown: /usr/bin/dbus-send -system -print-reply -dest="" /org/freedesktop/ConsoleKit/Manager .Stop Let's take an example : script.sh : /bin/sh sudo apt-get update Of course, if I execute this script, I get a prompt asking me for a password. The expression USER denotes a shell variable automatically set to contain the current users username. I saw as the only solution to put sudo INSIDE script.sh. Step 1: Enable passwordless sudo for the administrator. NOPASSWD and PASSWD By default, sudo requires that a user authenticate him or herself before running a command. Since hibernate is normally disabled by default in Ubuntu systems, you can enable this by checking this answer. 54 For some reason I need, as user, to run without sudo a script script.sh which needs root privileges to work. (This is due to Ubuntu's shift in using systemd instead of Upstart) systemctl poweroff A safe way to do this without using sudo and without tinkering with the system, is by executing these one-liner commands: For Ubuntu 15.04 and later: ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |