Start command as superuser at login (SOLVED)
How can I start a command as superuser at startup on Xubuntu? Normally I enter any command in the option 'Session and Startup -> Application Autostart', but I don't know how to do it as superuser since if I enter the command preceded by sudo or pkexec nothing happens (I also don't want to be asked for the password at startup, since I have already logged in).
51 Answer
I've finally fixed it by adding the hdparm command in sudoers. For this I have run sudo visudo and added the following line (important that it be added to the end of the file for the rule to apply): MY_USER ALL=(root) NOPASSWD: /sbin/hdparm, replacing "MY_USER" by my user.
Once this is done we can add the command in the "Start Applications" menu. The command must also have "sudo" in front.
In this thread there is a very similar case: [Run script as root immediately after login to gui
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"