start programs over X with ssh using sudo

If none of the more specific forums is the right place to ask

start programs over X with ssh using sudo

Postby Eazy » 2018-06-11 18:17

Hi!
I have trouble starting X-programs with sudo and ssh. I get this if I try:
Code: Select all
$ sudo medit
X11 connection rejected because of wrong authentication.


Every time I log in I have to run as su:
Code: Select all
xauth add $(xauth -f ~username/.Xauthority list|tail -1)

if I want to run a X-program as sudo.

I can start programs as normal user OK, so my ssh is working.

I have the latest Debian without X installed.
I log in to my Debian with:
Code: Select all
ssh -X server@IP

I have tried with -Y but the same problem.

Can I set my command (]xauth add $(xauth -f ~username/.Xauthority list|tail -1)) permanent so I don't have to run it every time i log in?

This problem is new to me. It has always worked out of the box.
Eazy
 
Posts: 10
Joined: 2009-07-01 20:19

Re: start programs over X with ssh using sudo

Postby Eazy » 2018-06-14 16:36

Really, no one?
Eazy
 
Posts: 10
Joined: 2009-07-01 20:19

Re: start programs over X with ssh using sudo

Postby wizard10000 » 2018-06-14 18:34

You'd use gksudo or gksu, same as if you were on your local machine.
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1279
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: start programs over X with ssh using sudo

Postby Head_on_a_Stick » 2018-06-15 05:14

Have you tried pkexec?

I think gksu{,do} is discouraged these days because it allows too many permissions.

Anyway, this is an XY-problem: the correct answer is of course
Code: Select all
sudoedit $file
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7544
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to General Questions

Who is online

Users browsing this forum: davidvt and 6 guests

fashionable