I'm SSHing into my RPi, with X forwarding enabled. I'm trying to run gparted, but it seems to fail for me.

$ gksudo gparted
libparted : 2.3
The program 'gksudo' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 229 error_code 10 request_code 130 minor_code 5)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)


pi@raspberrypi:~$ sudo gparted
X11 connection rejected because of wrong authentication.

(gpartedbin:21437): Gtk-WARNING **: cannot open display: localhost:10.0

If I run plain gparted, I get Root privileges are required for running gparted. in STDOUT, but I also get a dialogue box pop up. I've also run gksudo leafpad, which seems to work fine. How can I run gparted over ssh?


Make sure you have

ForwardX11 yes

in your local /etc/ssh/ssh_config

Now the problem is that when you sudo, you don't have the right credentials in .Xauthority. The -E option preserves your environment


$ sudo -E gparted
  • I use ~/.ssh/config instead, but, yes, as per the question, it is already enabled. Also (as per the question), X forwarding works fine when testing with leafpad.
    – Sparhawk
    Nov 20 '13 at 4:15

I had no luck with this:

ssh -X pi@mypi

but this worked:

ssh -Y pi@mypi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.