1

Connecting from an Ubuntu 18.04 computer to a headless Lubuntu 18.04 computer using X11 forwarding. It works great for apps that don't require root privileges: lxterminal, leafpad, etc. I can run sudo commands in the forwarded lxterminal window just fine.

But, applications like synaptic-pkexec that would normally pop up the Authentication window and ask me to enter a password, fail, like so:

$ synaptic-pkexec
==== AUTHENTICATING FOR com.ubuntu.pkexec.synaptic ===
Authentication is required to run the Synaptic Package Manager
Authenticating as: [my realname],,, ([my username])
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.

I supplied the correct password.

Is there a setting in sshd-config that governs this? What must I change to get this to work?

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
  • duplicate? https://askubuntu.com/questions/982766/how-to-use-synaptic-pkexec – Wayne Vosberg May 26 '20 at 16:31
  • @WayneVosberg I don't think so. I can run it just fine on the local computer. It only fails over ssh x11 forwarding. But I think I have figured it out anyway. Running final test. – Organic Marble May 26 '20 at 16:32
  • What about sudo synaptic-pkexec ? I've replicated your situation with a ubuntu 18 as the host and a lubuntu 18.04 as the guest in VBox and after SSHing to it graphically , I'm able to run synaptic as root with sudo. – Parsa Mousavi May 26 '20 at 16:38
  • 1
    What about sudo synaptic-pkexec ? I've replicated your situation with an ubuntu 18 as the host and a lubuntu 18.04 as the guest in VBox and after SSHing to it graphically , I'm able to run synaptic as root with sudo. – Parsa Mousavi May 26 '20 at 16:39
  • @ParsaMousavi I thought running graphical applications with sudo was discouraged. – Organic Marble May 26 '20 at 16:40
  • How did you configure your SSH server ? How do you connect to it ? ( I mean please add the command that you entered ) – Parsa Mousavi May 26 '20 at 16:43
  • @ParsaMousavi just the usual ssh -Y userid@server – Organic Marble May 26 '20 at 16:44

2 Answers2

2

Suboptimal solution:

After sshing in with X11 forwarding, run

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &

After that, synaptic-pkexec works great, the Authentication box pops up on the client computer and accepts my password.

You have to kill the authentication agent process before exiting the ssh session or it hangs, though.

I got the tip from here: https://github.com/NixOS/nixpkgs/issues/18012 but there it states that you can start the authentication agent on the server. That part didn't work for me, I got an error:

Cannot register authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: An authentication agent already exists for the given subject

So this works, but is a bit clumsy.

Hoping for a better answer.

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
0
sudo -E synaptic-pkexec

and

sudo --preserve-env=HOME synaptic-pkexec

both work for me.

elmicha
  • 9,728