3

I have installed sublime text 3 using official website docs. I can launch it from searching and clicking on sublime icon as well as from terminal just by typing subl. But nothing is working when I type

> sudo subl [some file name]

No error nothing is being displayed. How to resolve this? I have ubuntu 17.10

I am trying

> gksudo subl ~/.bashrc 
Unable to copy user's Xauthrisation file
dessert
  • 39,982
  • This doesn't address your problem but is relevant nevertheless: You should always use gksudo or rather kdesudo to start graphical programs, sudo is just for the command line. – dessert Nov 01 '17 at 12:50
  • What does which subl show? Did you try gksudo /full/path/to/subl? – dessert Nov 01 '17 at 12:52
  • Sorry I didn't know it but it was working fine in earlier versions – Brij Raj Kishore Nov 01 '17 at 12:52
  • Now I am trying to run

    gksudo subl ~./basrch

    I am getting this error

    Failed to run subl '/home/brij/.bashrc' as user root.

    Unable to copy the user's Xauthorization file. and also after giving the full path of sublime, same error is occuring

    – Brij Raj Kishore Nov 01 '17 at 12:55
  • If you want to add information relevant to the question, please always edit your question and use the formatting tools. – dessert Nov 01 '17 at 12:59
  • 1
    Are you running Xorg or Wayland? If Wayland, I think you are affected by the issue that is discussed and solved in the thread of this question, https://askubuntu.com/questions/961967/why-dont-gksu-gksudo-or-launching-a-graphical-application-with-sudo-work-with-w – sudodus Nov 01 '17 at 13:31
  • @sudodus I don't know. I have just freshly installed ubuntu 17.10 – Brij Raj Kishore Nov 01 '17 at 13:33
  • Run this command to check: echo $XDG_SESSION_TYPE: It will reply wayland or x11. – sudodus Nov 01 '17 at 13:39
  • It is saying wayland. – Brij Raj Kishore Nov 01 '17 at 13:41
  • Then you can try to use the link in my first comment in order to solve your problem. There are several solutions and workarounds. I wrote one answer with two methods, a simple function and a more complicated shellscript + desktop file + icon file. Some of the other answers are similar and some answers are different. Use the method that works best for you. Good luck :-) – sudodus Nov 01 '17 at 13:42

0 Answers0