sudo subl - how to open sublime 3 by terminal on Ubuntu?

Asked

Viewed 4,774 times

-1

I performed the installation of Sublime Text 3 on Ubuntu 17.10. I can open the Sublime using the command subl in the terminal. However it does not work to open as sudo, when using the command nothing happens.

But it works to run commands sudo subl -h to access the help of the sublime and sudo subl -v to see the version.

Below the contents of the sublime_text.desktop file

--------------------------------------------------------

rodolfo@rodolfo-ntb:/usr/share/applications$ cat sublime_text.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;
rodolfo@rodolfo-ntb:/usr/share/applications$ 

  • When using sudo -H ./sublime_text works perfectly here. In general, it is not recommended to open programs that save data in the user directory just as sudo, without'-H'.

  • Here it does not work that way, in my case it is in the directory /opt/sublime_text

1 answer

0

I got help in a group on Telegram, and this is not a bug. Ubuntu 17.10 is using Wayland, and Wayland does not allow running programs like sudo. Before signing in with the user I switched to start Ubuntu with Xorg and now the sudo subl command is working.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.