Desktop file for a service

Adithyansm

Active Member
Joined
Nov 11, 2021
Messages
209
Reaction score
84
Credits
1,495
Hello everyone :D
How can I create a .desktop file for a service to start?
the service is
Code:
sudo systemctl start emby-server.service
I want it to execute with sudo permission when clicked
you can provide me with the steps is to achieve this or you can give me the format for the desktop file
Help would be appreciated
 


SlowCoder

Gold Member
Gold Supporter
Joined
May 2, 2022
Messages
339
Reaction score
239
Credits
2,718
Potentially unsafe, and/or may not work. Untested.

1. Create [script] on your desktop, with your command (minus "sudo").
2. chmod +swrx [script] - allows the normal user to edit and execute file after ownership changes. also sets the setuid flag.
3. chown root:root [script] - change ownership to root.

What you should end up with is a script that belongs to, and is run as root, and is maintainable by normal user. Shouldn't require sudo.

Anyone else who'd like to check my work ... please do.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Latest posts

Top