problem with VNC setup

Hi,

I am trying to configure vnc on my home server from may laptop. Both are running opensuse leap along with KDE.

I have googled for days with no luck.

So i install tightvnc on server from ssh connection using yast on terminal.

then i run

susebox:~ # vncserver 
xauth: (argv):1:  bad display name "susebox:2" in "add" command

New 'susebox:2 (admin)' desktop is susebox:2

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/susebox:2.log
susebox:~ # vncviewer susebox:2

TigerVNC Viewer 64-bit v1.6.0
Built on: ??-??-?? ??:??
Copyright (C) 1999-2015 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Can't open display: 


i tried # vncviewer ip_server:2 also got an error

i disable firewall, still no luck…
i have find this topic here, there are lot covered my topic but still i couldn’t solve my problem…

First question, is susebox the remote PC?

yes, susebox is pc i want to remote.

If susebox is the remote machine, then you are trying to run the viewer on the remote machine. You need to run it locally.

After you have run vncserver on the remote machine, log out of that ssh session, keep the console open, but keep note that the display number, in this case, is 2. This number might be different the next time you evoke vncserver on that machine, so remember to pay attention to that number.

Now, the generic command you would issue would be like this, but since you are spawning a new desktop session on the remote machine, look to the next example for the changes you need to make:
NORMALLY:

ssh -t -L 5900:localhost:5900 YourUser@xxx.xxx.xxx.x 'x11vnc -localhost -nolookup -nopw -display :0'

That is normally how you would open the x11vnc ssh connection from your machine to the remote machine, if the user is already logged into the desktop.

However, since you are not connecting to display 0, but instead to display 2 in your above example, you need to change the 5900 to 5902 and the display:0 to display:2, like this:

ssh -t -L 5902:localhost:5902 YourUser@xxx.xxx.xxx.x 'x11vnc -localhost -nolookup -nopw -display :2'

Leave that console window open.

Of course, you need to be certain that the 590x ports are open in your firewall.

Also, if going through a router remotely over the internet, you need to map those ports in the router to your server.

Then, you need to open a second console locally, and issue:

vncviewer localhost:2

… or, you could just issue:

vncviewer

and a small gui will pop up, where you can enter the

localhost:2

in the provided box.

Do not worry about any notice that the connection is not secure: It is, since you are connected through an ssh connection (the first part of the command given in the first terminal window).

thanks fraser was bit struggle to running command
but now it works :good:

I keep a copy of that first command in a small “connectivity” textfile where I can just copy it, paste it, and make any necessary changes. Makes it a lot easier.

You are welcome, have fun.