Page 4 of 6

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 8:30 am
by gm10
Mr_Sinister wrote:
Thu Jul 05, 2018 8:00 am
kc1di wrote:
Thu Jul 05, 2018 5:12 am
MintBean wrote:
Tue Apr 24, 2018 5:14 pm
In Nemo you can browse to a folder, right click on the background in the file display area and select 'open as root.' Displaying a file from the window will then open the editor with elevated privileges.
This works in caja also.
Nope,
Just upgraded from 18.3 to 19 and this particular feature is gone. And I need it badly.
There are only few extensions installed by default. The one you are looking for is:

Code: Select all

apt install caja-admin
The edit as administrator function is hardcoded to use pluma as the editor though, so you'll either have to install that, modify the script or install caja-actions and just define your own menu entry to do that.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 8:36 am
by Mr_Sinister
Marziano wrote:
Thu Jul 05, 2018 8:04 am
Nope,
Just upgraded from 18.3 to 19 and this particular feature is gone. And I need it badly.
That's odd.It works in Ubuntu 18.04 MATE. Why would Mint have removed the option? Can you open Caja with:

Code: Select all

pkexec caja
from a terminal?
"Could not parse arguments: can't open screen."
I've discovered that gksu is actually still installed. Nevertheless it's not working the way it was before.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 8:40 am
by Mr_Sinister
gm10 wrote:
Thu Jul 05, 2018 8:30 am
Mr_Sinister wrote:
Thu Jul 05, 2018 8:00 am
kc1di wrote:
Thu Jul 05, 2018 5:12 am

This works in caja also.
Nope,
Just upgraded from 18.3 to 19 and this particular feature is gone. And I need it badly.
There are only few extensions installed by default. The one you are looking for is:

Code: Select all

apt install caja-admin
The edit as administrator function is hardcoded to use pluma as the editor though, so you'll either have to install that, modify the script or install caja-action and just define your own menu entry to do that.
Thank you very much! This has saved me a lot of trouble. I suppose I can freely remove gksu altogether?

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 8:55 am
by gm10
Mr_Sinister wrote:
Thu Jul 05, 2018 8:40 am
I suppose I can freely remove gksu altogether?
Yes, those extensions use pkexec instead.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 8:57 am
by xenopeek
I really thought caja-admin was installed by default. Is this perhaps because of upgrading in place that it was missing?

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 8:59 am
by gm10
xenopeek wrote:
Thu Jul 05, 2018 8:57 am
I really thought caja-admin was installed by default. Is this perhaps because of upgrading in place that it was missing?
Nope. Ubuntu MATE 18.04 has it by default, Mint 19 MATE does not, maybe that's what has you confused.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:07 am
by altair4
cryptodan wrote:
Thu Jul 05, 2018 12:14 am
How do you run commands like system-config-samba
Fun fact: The person who is requesting that system-config-samba be removed from the repositories ( Please remove system-config-samba from Ubuntu ) is the exact same person who asked for gksu to be removed ( Remove gksu from Ubuntu )

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:15 am
by xenopeek
gm10 wrote:
Thu Jul 05, 2018 8:59 am
xenopeek wrote:
Thu Jul 05, 2018 8:57 am
I really thought caja-admin was installed by default. Is this perhaps because of upgrading in place that it was missing?
Nope. Ubuntu MATE 18.04 has it by default, Mint 19 MATE does not, maybe that's what has you confused.
You are incorrect. I just checked on a fresh install of Linux Mint 19 MATE and caja-admin is installed by default.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:16 am
by smurphos
gm10 wrote:
Thu Jul 05, 2018 8:59 am
xenopeek wrote:
Thu Jul 05, 2018 8:57 am
I really thought caja-admin was installed by default. Is this perhaps because of upgrading in place that it was missing?
Nope. Ubuntu MATE 18.04 has it by default, Mint 19 MATE does not, maybe that's what has you confused.
It's present and correct on a freshly installed Mate 19 over here...

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:17 am
by xenopeek
altair4 wrote:
Thu Jul 05, 2018 9:07 am
Fun fact: The person who is requesting that system-config-samba be removed from the repositories ( Please remove system-config-samba from Ubuntu ) is the exact same person who asked for gksu to be removed ( Remove gksu from Ubuntu )
It's been removed by about every other distro as upstream it was discontinued years ago. The fact that Ubuntu still has it in the universe repo is more a symptom of that state of that repo than anything else.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:19 am
by xenopeek
smurphos wrote:
Thu Jul 05, 2018 9:16 am
I just gotta say I like the new avatar :mrgreen:

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:19 am
by gm10
xenopeek wrote:
Thu Jul 05, 2018 9:15 am
You are incorrect. I just checked on a fresh install of Linux Mint 19 MATE and caja-admin is installed by default.
You are correct. Maybe it wasn't installed automatically in the beta version and that's what I was remembering? I don't have the beta iso anymore so can't check.

If he had it in Mint 18.3 and it went missing with the upgrade then I suppose there's a problem with the upgrade script.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Thu Jul 05, 2018 9:24 am
by Mr_Sinister
xenopeek wrote:
Thu Jul 05, 2018 8:57 am
I really thought caja-admin was installed by default. Is this perhaps because of upgrading in place that it was missing?
Maybe it's because it was not a fresh install. I don't know. All I know it works now.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Fri Jul 06, 2018 5:54 am
by ingeva
Mr_Sinister wrote:
Thu Jul 05, 2018 8:00 am
kc1di wrote:
Thu Jul 05, 2018 5:12 am
MintBean wrote:
Tue Apr 24, 2018 5:14 pm
In Nemo you can browse to a folder, right click on the background in the file display area and select 'open as root.' Displaying a file from the window will then open the editor with elevated privileges.
This works in caja also.
Nope,
Just upgraded from 18.3 to 19 and this particular feature is gone. And I need it badly.
Go to /usr/bin/ and make a symbolic link to pkexec. Call it "gksu":
cd /usr/bin
sudo ln -s pkexec gksu

That's it.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Fri Jul 06, 2018 6:02 am
by ingeva
Pjotr wrote:
Thu Jul 05, 2018 5:06 am
ingeva wrote:
Thu Jul 05, 2018 4:11 am
I copied /usr/bin/gksudo from an 18.3 distribution to my 19 distro. Works just fine.
You're taking risks, though... Note that pkexec is by design more secure than gksu (which is why gksu was abandoned in the first place), and furthermore: gksu doesn't get any security updates anymore.

I advise to go with the flow, and switch to pkexec and admin://.
You're right, of course. I have corrected my post.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Sun Aug 19, 2018 2:26 pm
by nichot20
I have fallen foul of the gksu removal, and none of the discussions I haver seen in this thread come anywhere near my use case AFAIK, so use of admin:// etc does not seem to work.

My use case is having a simple bash script to mount/unmount several windows shares using a command of the form "mount.cifs ${server}/${sleaf:-$remote} $Mount_point_root/$leaf -o $Options" which is invoked in a looper to mount several shares when I am on a particular network.

This bash script was itself invoked by a .desktop file using a line of the form 'Exec=gksu -S "/home/tim/bin/mounter/mount.sh woodentop"'

using admin:///home/tim/bin/mounter/mount.sh woodentop fails with a "no such file or directory" error

using pkexec /home/tim/bin/mounter/unmount.sh woodentop pops up a password window similar to gksu but then fails with a "Unable to init server: Could not connect: Connection refused"

I suspect this may be because some form of config file is needed somewhere in a policykit config folder but I cannot readily relate the man page example to my use case as it seems to refer to options that I have no equivalent for.

Any pointers appreciated.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Sun Aug 19, 2018 4:12 pm
by xenopeek
You can replace gksu with sudo and set Terminal=true in the .desktop file. That way the script will run in a terminal and you can enter your password on the terminal. You were only using gksu because it provided you with a dialog to enter your password I assume. So you can instead use the regular sudo password prompt on the terminal. This is the easiest and most future proof.

Alternatively you can install an askpass program and use that to provide sudo with a dialog to enter your password. A dialog similar to what gksu provided for your script. For example the package ssh-askpass-gnome provides an askpass program you can use for this. After installing it you can run a command like:
SUDO_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass sudo -A bash
and it will show a dialog prompt to enter your password, after which it will run bash as root. If you have just one command in your script that needs root, just prefix it in your script with that (replace bash in above with your command) and you can remove gksu from your .desktop file. If you have multiple commands that need root in your script you'll have to tinker with your .desktop file a bit. Likely you'll need to replace the Exec command with something like this to be able to set the SUDO_ASKPASS variable:
Exec=bash -c 'SUDO_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass sudo -A "/home/tim/bin/mounter/mount.sh woodentop"'

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Sun Aug 19, 2018 4:42 pm
by gm10
xenopeek wrote:
Sun Aug 19, 2018 4:12 pm
Alternatively you can install an askpass program and use that to provide sudo with a dialog to enter your password. A dialog similar to what gksu provided for your script. For example the package ssh-askpass-gnome provides an askpass program you can use for this. After installing it you can run a command like:
SUDO_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass sudo -A bash
and it will show a dialog prompt to enter your password, after which it will run bash as root. If you have just one command in your script that needs root, just prefix it in your script with that (replace bash in above with your command) and you can remove gksu from your .desktop file. If you have multiple commands that need root in your script you'll have to tinker with your .desktop file a bit. Likely you'll need to replace the Exec command with something like this to be able to set the SUDO_ASKPASS variable:
Exec=bash -c 'SUDO_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass sudo -A "/home/tim/bin/mounter/mount.sh woodentop"'
just add

Code: Select all

export SUDO_ASKPASS="/usr/lib/openssh/gnome-ssh-askpass"
to your ~/.profile and sudo will pop up the password question automatically without you having to change any command lines (once you log in the next time).

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Mon Aug 20, 2018 1:40 am
by xenopeek
You still need to use sudo -A in that case to use askpass, right?

Another alternative is to reconfigure sudo so that the script is permitted to be run as root without a password prompt. That gets complicated though.

Re: gksu removed from the repo's of Ubuntu 18.04

Posted: Mon Aug 20, 2018 2:22 am
by gm10
xenopeek wrote:
Mon Aug 20, 2018 1:40 am
You still need to use sudo -A in that case to use askpass, right?

Another alternative is to reconfigure sudo so that the script is permitted to be run as root without a password prompt. That gets complicated though.
No, as long as sudo finds the environment variable it will pop the question automatically. ;) I'm not sure if that's intentional (see manual seems to indicate otherwise) but it's how it works.

Your alternative has, of course, security implications.