[SOLVED] su-to-root not working

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

[SOLVED] su-to-root not working

Post by powerhouse »

I've been using luckybackup for the past few years. When it installs, it creates the following launcher entry to start as superuser:

Code: Select all

su-to-root -X -c /usr/bin/luckybackup
This has worked fine until Linux Mint 18.3. Now with Linux Mint 19 it doesn't work, nor does any other option work :cry: .

I tried pkexec, sudo -i, gksudo, you name it.

What has changed and how do I run this application in a root environment (user=root, home=root), like sudo -i.

It's a graphical application.

P.S.: Running

Code: Select all

sudo -i luckybackup
in a terminal window works.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
JeremyB
Level 21
Level 21
Posts: 13854
Joined: Fri Feb 21, 2014 8:17 am

Re: su-to-root not working

Post by JeremyB »

Starting in 18.3 for fresh installs no password was set for the root account basically disabling the use of su
altair4
Level 20
Level 20
Posts: 11454
Joined: Tue Feb 03, 2009 10:27 am

Re: su-to-root not working

Post by altair4 »

According to the Ubuntu man page for "su-to-root": http://manpages.ubuntu.com/manpages/bio ... oot.1.html
ENVIRONMENT

SU_TO_ROOT_X
Select the su-like program called by su-to-root -X. Supported values are gksu,
kdesu, kde4su, ktsuss,
sux, gksudo and kdesudo. kde4su denotes the KDE4 version of kdesu.

When this variable is not set su-to-root will currently try to use gksu, kdesu,
kde4su, ktsuss, sux and the built-in code, in that order with the exception that
under a KDE session, kdesu and kde4su are prefered over gksu.
There is no gksu, gksudo, whatever the hell ktsuss was, ...

You need to make your own polkit rule: Luckybackup super-user not available after install via Software Manager

EDIT: I deviated from that link at the end and after createing the polkit file I edited /usr/share/applications/luckybackup-gnome-su.desktop and changed this line:

Code: Select all

Exec=su-to-root -X -c /usr/bin/luckybackup
To this:

Code: Select all

Exec=pkexec /usr/bin/luckybackup
Now the existing menu Item will run as root.
Last edited by altair4 on Sat Jul 14, 2018 2:26 pm, edited 2 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: su-to-root not working

Post by Flemur »

As far as I can tell, this acts like "gksudo" except you get a terminal instead of a text box to enter the password, so you can use it in menus and such.

Code: Select all

$ cat ~/bin/Gksudo
#!/bin/sh
#
# Use this when gksu goes away.
#
xfce4-terminal --command="sudo -H -i -u root bash -c '$*' &" --geometry=45x10 
Usage:

Code: Select all

Gksudo command
FWIW, when I updated 18.3 to 19, gksudo and everything else continued to work, but pkexec has never worked anywhere. (I went back to 18.3 until the upgrade path is fixed).
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: su-to-root not working

Post by powerhouse »

Thanks for all the replies. I won't be back at my Linux PC for a couple of days, but will give the suggestions a try. pkexec on the command line didn't work. Perhaps the polkit change will do the job.

The fact that Luckybackup doesn't install the super-user launcher anymore is a bug! It should be fixed.

Changing command syntax with every Linux Mint / Ubuntu release is a bad habit. Instead of improving on gksu/gksudo, why the hell did they have to reinvent the wheel? If car manufacturers would do the same, we would have to relearn driving with every new model that comes out. Yet the steering wheel is in the same place as decades ago, so are brakes, accelerator, the winker and lights switches.

It's ridiculous that I have to post this stupid question on how to do the most basic thing in Linux Mint - how to run a GUI command as super-user - just because of a model upgrade. Imagine you got your new car and need to post on the forum to be able to drive it?

Again thanks to the forum users and admins who helped out here so quickly! But the command line syntax of basic commands SHOULD NOT CHANGE.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: su-to-root not working

Post by powerhouse »

altair4 wrote: Sat Jul 14, 2018 12:54 pm According to the Ubuntu man page for "su-to-root": http://manpages.ubuntu.com/manpages/bio ... oot.1.html
ENVIRONMENT

SU_TO_ROOT_X
Select the su-like program called by su-to-root -X. Supported values are gksu,
kdesu, kde4su, ktsuss,
sux, gksudo and kdesudo. kde4su denotes the KDE4 version of kdesu.

When this variable is not set su-to-root will currently try to use gksu, kdesu,
kde4su, ktsuss, sux and the built-in code, in that order with the exception that
under a KDE session, kdesu and kde4su are prefered over gksu.
There is no gksu, gksudo, whatever the hell ktsuss was, ...

You need to make your own polkit rule: Luckybackup super-user not available after install via Software Manager

EDIT: I deviated from that link at the end and after createing the polkit file I edited /usr/share/applications/luckybackup-gnome-su.desktop and changed this line:

Code: Select all

Exec=su-to-root -X -c /usr/bin/luckybackup
To this:

Code: Select all

Exec=pkexec /usr/bin/luckybackup
Now the existing menu Item will run as root.
Thanks, altair4 !

However, I need to correct this: The original solution you linked to is correct:

Code: Select all

pkexec /usr/bin/luckybackup
Running

Code: Select all

Exec=pkexec /usr/bin/luckybackup
will not ask for a password, and will not change to the /root environment. It will use the LuckyBackup proviles from the user /home/user/.luckyBackup folder. However, all my proviles using root privileges are saved in /root/.luckyBackup.

Code: Select all

pkexec /usr/bin/luckybackup
produces the expected result.

Without your post I would be still looking for the needle in the haystack.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
altair4
Level 20
Level 20
Posts: 11454
Joined: Tue Feb 03, 2009 10:27 am

Re: [SOLVED] su-to-root not working

Post by altair4 »

I think we are talking about two different launchers. I actually did this before I made that post so just to make sure we are on the same page:

The original Marziano solution was to:

[Step1] Create the /usr/share/polkit-1/actions/luckybackup.policy file
[Step2] Then to verify that it worked run:

Code: Select all

pkexec /usr/bin/luckybackup
[Step3] Then create a launcher with that same expression: pkexec /usr/bin/luckybackup

What I did was follow Step1 and Step2 then to make it so the original Menu item worked I edited it's launcher by editing: /usr/share/applications/luckybackup-gnome-su.desktop

When you look at the file it was originally set to Exec=su-to-root -X -c /usr/bin/luckybackup
Setting it to pkexec /usr/bin/luckybackup without the Exec= part will make it so the luckyBackup ( super user ) entry in the menu disappear and the .desktop file will not run..

Run the following command to verify for yourself:

Code: Select all

cat /usr/share/applications/luckybackup-gnome-su.desktop
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: [SOLVED] su-to-root not working

Post by powerhouse »

altair4 wrote: Thu Jul 19, 2018 2:07 pm I think we are talking about two different launchers. I actually did this before I made that post so just to make sure we are on the same page:

The original Marziano solution was to:

[Step1] Create the /usr/share/polkit-1/actions/luckybackup.policy file
[Step2] Then to verify that it worked run:

Code: Select all

pkexec /usr/bin/luckybackup
[Step3] Then create a launcher with that same expression: pkexec /usr/bin/luckybackup

What I did was follow Step1 and Step2 then to make it so the original Menu item worked I edited it's launcher by editing: /usr/share/applications/luckybackup-gnome-su.desktop

When you look at the file it was originally set to Exec=su-to-root -X -c /usr/bin/luckybackup
Setting it to pkexec /usr/bin/luckybackup without the Exec= part will make it so the luckyBackup ( super user ) entry in the menu dissapear.

Run the following command to verify for yourself:

Code: Select all

cat /usr/share/applications/luckybackup-gnome-su.desktop
Oooops, you are right! I changed the launcher in the Mate menu, not

Code: Select all

cat /usr/share/applications/luckybackup-gnome-su.desktop
.
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Locked

Return to “MATE”