You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Create Launcher Icon to Run As Administrator

Author (Read 6737 times)

0 Members and 3 Guests are viewing this topic.

Re: Create Launcher Icon to Run As Administrator
« Reply #3 on: November 27, 2018, 10:47:25 AM »
 

jack action

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 4
  • Linux Lite Member
    • View Profile

  • Kernel: 5.x
As a new user of LL, I've been tackling with a similar problem for a long time now.

First, you won't be able to run as administrator without entering the administrator password.  It would violate the security protocol.  You're either an administrator or you're not.

And the reason I wanted to respond to this thread is because gksudo, as suggested in the tutorial, was not working for me and is also deprecated (ref.: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892768).

The actual method used in LL is:

Code: [Select]
pkexec thunar [filename]
You can verify this by opening the file manager (i.e., open any directory).  These windows are managed by the program Thunar.

On this window menu, select Edit -> Configure custom actions...; The window Custom Actions will appear.

These are all the definitions for the items appearing in the right-click menu in Thunar (ref.: https://linuxliteos.com/manual/install.html#secureerase).  You can select Open as Administrator and click Edit (the slanted pencil on the left).  The window Edit action will appear.

On the line Command, you can find the code I previously presented.

I used this code for the command box when I wanted to add items in 'Menu' (found in the panel) with the Menu Editor (MenuLibre) to run programs as an Administrator.

Creating a Launcher that opens as administrator
  • Click 'Menu' on the desktop panel;
  • Type 'menu' in the search bar.  The program Menu Editor should appear in the available choices above, click on it;
  • In the window that appeared, in the left panel, select the directory you wish to install your Launcher;
  • Click the '+' sign in the top menu and select Add Launcher;
  • On the right panel, you can click on the icon, the title ('New Launcher') and the description ('A small descriptive blurb about this application.') to modify them;
  • On the command box, type the code pkexec thunar [filename], where [filename] is the filename (with the full path) of the desired file;
  • Click Save Launcher (the down arrow) in the top menu.
Your new launcher is now in the 'Menu' of the desktop panel (in the directory you chose).

As an example, I created a Launcher for XAMPP.  The instructions ask me to execute the following code on the command line (ref.: How do I start XAMPP?):
Code: [Select]
cd /opt/lampp

sudo ./manager-linux.run (or manager-linux-x64.run)

With my installation, I actually had the file /opt/lampp/manager-linux-x64.run. So I used this command for my Launcher:
Code: [Select]
pkexec thunar /opt/lampp/manager-linux-x64.run
pkexec opens a graphical interface to get the administrator's password and then runs the program thunar as the administrator and asks thunar to execute the given file.
 

Re: Create Launcher Icon to Run As Administrator
« Reply #2 on: September 27, 2018, 05:37:09 PM »
 

bitsnpcs

  • Platinum Level Poster
  • **********
  • 3237
    Posts
  • Reputation: 305
    • View Profile
    • Try to Grow

  • Kernel: 4.x
Hello idResponse,

there is a tutorial of how to do this here - https://askubuntu.com/questions/118822/how-to-launch-application-as-root-from-unity-launcher
 

Create Launcher Icon to Run As Administrator
« Reply #1 on: September 27, 2018, 05:26:41 PM »
 

idResponse

  • New to Forums
  • *
  • 1
    Posts
  • Reputation: 0
  • Linux Lite Member
    • View Profile
I want to create a launcher for projectM that automatically runs it as SU.
Currently, I can right click on the icon and select "Run as Administrator" and it works.
I would like to be able to bypass that and just be able to doubleclick to open it.
Can't seem to find how this works anywhere... Thanks!
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section