groot , works like GKSU or pkexec or not
Posted
#1
(In Topic #473)
Banned
I just made this today.
It occurred to me that i could possibly get an app to launch as root by creating a hidden TerminalView object and running the application with sudo through it, using the TerminalView.Input() method to send the password.
Turns out it can
so this app is called groot.
(attachment removed)
It's tiny, not much code.
It simply takes any provided arguments , puts 'sudo' in front of it and executes in the hidden terminaview.
Kinda works like that pkAppMan thing i made but without all the flaffing about with pkexec policies
Just run the install script to copy it to your /usr/bin folder then you can set menu items and desktop launchers and the like to sudo up your apps.
Has an option to just run as normal user too.
after installing it you could for example copy your pluma text editor menu launcher onto your desktop and change it's command from
'pluma %U' to
'groot pluma %U'
then either clicking the launcher or dragging files onto it will give you the option to run as root or not
.
Like i said not much code to it really..
Code (gambas)
- ' Gambas class file
- ' If no arguments have been passed then there's nothing to do.
- aArgs.Delete(0) ' remove the 1st Argument as it's groot
- ' Set the label text file info
- ' User did not cancel so run without root.
- Else ' Password has been entered so go for root...
- aArgs.Add("sudo", 0) ' insert 'sudo' as first argument
- RunCommand()
- ' if not running as root just Exec the command without teminalview and quit.
- Exec aArgs
- ' create a terminalview object to run sudo in
- ' Execute the command creating the Process.
- ' give it a moment then send the root password
- Wait 0.8
- ' Wait for the process to finish before quiting so as not to invalidate the process stream.
- Wait 0.5
- ' Command has finished so we can clean up and exit.
- Print "User cancelled superuser request."
- ' Show and hide again the password on holding the button down.
- mbxPass.SetFocus
- ' user pressed RETURN after password
- btnOK_Click()
Posted
Banned
It's actually quite functional this app so i prettied it up a bit.
Gave it some changeable/saveable settings ( font and colours)
Made it pop up at Mouse position instead of center screen.
A little opacity too
Compiled 3 different versions. QT only, GTK only, or both.
(this is because gtk does not set the text field background colour but QT does so i want to have the QT version on mt gtk desktop.)
Gave a saveable option to just run normally if no password is entered.
Made the "Run Nomally" button hide if above method used.
made the password box regain focus on activate.
(attachment removed)
Todo:
May look into encryption to save the root password as a setting and allow you to let some apps to auto-run as root without asking for the password.
Probably add some default start position option Ie, select center-screen, top-left or Mouse pos
Posted
Banned
For years i used GKSU then it disappeared.
so after much searching i found the .deb installers for GKSU and it's libraries that worked and had to manually install it on each linux install,
Then it just disapeared completely and i had to move onto figuring out using pkexec and setting policy rules.
Then i made gambas apps and scripts so others could more easily accomplish the same thing with pkexec and wrote instructions and stuff
Then….
Then…
In just a few hours i knocked up a program that's doing Everything GKSU did and more
Gotta love gambas
Posted
Banned
I found on some linux configs the window height was wrong so changed the way it lays out.
Also now it tries to show the icon of the app you are running..
(attachment removed)
It also now detects a wrong password entry and offers to retry.
1 guest and 0 members have just viewed this.





