web123456

Linux/ubuntu server enables port 6010-X11 service-ssh connection

This article was first published on my personal blog:Linux/ubuntu server enables port 6010-X11 service-ssh connection — zhang0peter's personal blog


Check mine at nightLinux-When the port status of the ubuntu server is found to be opened with port 6010:

-> # nmap -p 1-65535 127.0.0.1

Starting Nmap 7.60 (  ) at 2020-01-22 19:13 CST
Nmap scan report for  (127.0.0.1)
Host is up (0.0000040s latency).
Not shown: 65531 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
6010/tcp open  x11
6011/tcp open  x11
6013/tcp open  x11

Nmap done: 1 IP address (1 host up) scanned in 7.63 seconds
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

I thought it was installed before the servervnc server, No, the ports of 6010, 6011, 6013 are open. For details, please refer to this article:Linux/ubuntu server 18.04 Install Remote Desktop – vnc server-tightvncserver — zhang0peter's personal blog

Check the corresponding process of the port:

-> # netstat -tunlp|grep 6010
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      29899/sshd: ubuntu@ 
-> # ps -aux | grep 29899
ubuntu   29899  0.0  0.3 107988  5664 ?        S    20:27   0:00 sshd: ubuntu@pts/0
  • 1
  • 2
  • 3
  • 4
-> # netstat -tunlp|grep 6013
tcp        0      0 127.0.0.1:6013          0.0.0.0:*               LISTEN      8326/sshd: ubuntu@p 
-> # ps -aux | grep 1911     
ubuntu    1911  0.0  0.3 108120  6316 ?        S    17:45   0:00 sshd: ubuntu@pts/1
  • 1
  • 2
  • 3
  • 4

It is found that the program that initiates x11 forwarding is notxrdporvnc, butsshd, I suddenly thought of the reason.

I usexshellConnect to the server,xshellIt is enabled by defaultx11Forwarded.

If you run the commands of the graphical interface program on the command line, such asgedit,SoxshellYou will be prompted as follows:

-> # gedit 
Unable to init server: Could not connect: Connection refused
(gedit:1603): Gtk-WARNING **: 20:49:59.939: cannot open display: localhost:12.0
  • 1
  • 2
  • 3
Xmanager software is required to handle X11 forwarding requests.
 When you install Xmanager, you can...
 (To close this message, just close the X11 forwarding option in the Session Properties -> Connections -> SSH -> Tunnel page.)
  • 1
  • 2
  • 3

xshell is enabled by defaultx11Forwarding is because Xmanager needs to spend money to download, it hopes you can download itsoftwareIt's easy to make money.

If you want toWindowsX11 forwarding is recommended forMobaXtermThis software comes with X11 forwarding.

It will cause an error when running directly with root user. It is recommended to use it.sudoRun the command.

-> # gedit
MoTTY X11 proxy: Unsupported authorisation protocol
Unable to init server: Could not connect: Connection refused
(gedit:3978): Gtk-WARNING **: 21:00:13.560: cannot open display: localhost:15.0

-> % sudo gedit
(gedit:3876): GLib-GIO-CRITICAL **: 21:00:05.062: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
(gedit:3876): dconf-WARNING **: 21:00:05.076: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

For more content, please refer to this article, which is well written:Using X11 Forwarding to run graphical interface software on VPS - Tech Notes of Code Monkey