D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Replacement for gksu

 

On 21/04/2021 16:16, Neil wrote:
Some time ago I used to use gksu in order to make changes to a system file. That was superseded by admin. Now I am trying again and I am having problems. I am typing very carefully but it keeps saying it can't find the file.

This sounds a lot more like a "the filepath is wrong" error and likely has nothing to do with gksu. I suspect user error specifically...

Rather than framing gksu for an unknown error could you describe exactly what you're doing and the error message?

Try not to launch GUI apps as root anyway. Proving your DE is sane it will escalate your privileges for you automatically with a prompt via policykit: a good example is launching gparted on Fedora or Ubuntu Gnome or KDE editions. Both will prompt for the user password - providing your user account has the correct privileges via group membership of wheel/sudo - and escalate correctly.

Don't bodge around looking for flaky alternatives to prop up broken behaviour either: gksu was removed for a reason.

I'm not without sympathy: not all users are confident enough to use terminal commands to edit files and that's fair enough. I'm imagining your specific usage case is that you want to edit a root-owned config file using a GUI text editor such as gedit or kate? If something like:

sudo vi /etc/something.conf

is a bit too daunting the 'correct' workaround is to copy the file elsewhere first and change the permissions so you can edit the file in place safely using whatever editor you prefer.

sudo cp /etc/something.conf ~/something.conf
sudo chown $USER something.conf

Now you can do what you want with the file whist leaving the original untouched. When the edits are made change the ownership back and move the file back into place:

sudo chown root ~/something.conf
sudo cp /etc/something.conf /etc/something.conf.BAK
sudo cp ~/something.conf /etc/something.conf

This has the advantage of not clobbering your original file and working safely on something important in a friendly environment if you don't like editing complex system stuff in a shell window.

Even XFCE supports GVFS so as Sebastien pointed out there is a "new" method to access files via a admin:///path/to/file UNC but quite frankly it sucks. If you're not confident enough to be bashing root configs about in place via a shell you shouldn't be confident enough to be editing any root-owned config files in place anyway. Copy them elsewhere first, chmod, edit, backup the original and replace. UNIX philosophy and it's been working fine for over 40 years - just use common sense and the existing tools.

Hopefully that makes sense. This is more of a "correct approach" thing rather than a "find me a new tool to replace the old one" question.

--
The Mailing List for the Devon & Cornwall LUG
https://mailman.dcglug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq