problems with sudo: "Gtk-WARNING **: cannot open display: :0"

view full story

http://crunchbang.org – recently, after a regular update/upgrade (i actually were using Wheezy from a long time from Crunchbang), when i enter "sudo synaptic" at the terminal, i get:Invalid MIT-MAGIC-COOKIE-1 key (synaptic:3248): Gtk-WARNING **: cannot open display: :0and the same when i try "sudo pluma", "sudo gedit", "sudo caja --no-desktop", "sudo gedit --no-desktop", etc.from http://www.linuxquestions.org/questions … ost4861870 i found a temporary solution, which there they say:echo $DISPLAY # you'll be needing this value 3 lines below sudo (HowTos)