You are not logged in.
Pages: 1
I followed Wiki https://wiki.archlinux.org/title/TigerVNC, to set up my server on Arch Linux.
But failed when I try to connect it, the client shows an Error:
The port on which the computer is listening for a connection could not be contacted.
My /etc/tigervnc/vncserver.users file looks like this:
# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:2=lhqwd
And ~/.vnc/config file:
session=plasma
geometry=1920x1080
localhost
alwaysshared
I started the VNC by:
systemctl start vncserver@:2.service
And checked with
systemctl status vncserver@:2.service
, got:
● vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2021-12-13 19:08:14 UTC; 5min ago
Process: 992 ExecStart=/usr/bin/vncsession-start :2 (code=exited, status=0/SUCCESS)
Main PID: 1000 (vncsession)
Tasks: 0 (limit: 9364)
Memory: 944.0K
CPU: 15ms
CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service
‣ 1000 /usr/bin/vncsession lhqwd :2
Plz, help
Last edited by arch_user_xric (2021-12-13 17:09:34)
Offline
Are you trying to connect from the local machine or tunneling over ssh? The localhost directive will enforce localhost only.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Are you trying to connect from the local machine or tunneling over ssh? The localhost directive will enforce localhost only.
Thanks for your reply.
I did try to connect VNC-server while a ssh is still linked to Arch, so I:
1) turned off ssh service by:
systemctl stop sshd
2) disabled sshd (to stop it from auto start ?):
systemctl disable sshd
3)Reboot my Arch.
However, the error still exists.
The machine I use as a client(192.168.1.102) is in the same WLAN as my Arch(192.168.1.103::5902).
Last edited by arch_user_xric (2021-12-13 12:51:17)
Offline
On the VNC host (server):
ss -tulpen
On the client:
nmap 192.168.1.103
nmap -Pn -p 5902 192.168.1.103
Offline
On the VNC host (server):
ss -tulpen
On the client:
nmap 192.168.1.103 nmap -Pn -p 5902 192.168.1.103
On server, by ss -tulpen:
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 *:1716 *:* uid:1001 ino:44633 sk:2002 cgroup:/user.slice/user-1001.slice/session-6.scope v6only:0 <->
udp UNCONN 0 0 *:1716 *:* users:(("kdeconnectd",pid=914,fd=14)) uid:1000 ino:25697 sk:1 cgroup:/user.slice/user-1000.slice/session-4.scope v6only:0 <->
tcp LISTEN 0 5 127.0.0.1:5902 0.0.0.0:* uid:1001 ino:43753 sk:2003 cgroup:/user.slice/user-1001.slice/session-6.scope <->
tcp LISTEN 0 5 [::1]:5902 [::]:* uid:1001 ino:43754 sk:2004 cgroup:/user.slice/user-1001.slice/session-6.scope v6only:1 <->
tcp LISTEN 0 50 *:1716 *:* uid:1001 ino:44634 sk:2005 cgroup:/user.slice/user-1001.slice/session-6.scope v6only:0 <->
tcp LISTEN 0 50 *:1717 *:* users:(("kdeconnectd",pid=914,fd=15)) uid:1000 ino:25699 sk:1004 cgroup:/user.slice/user-1000.slice/session-4.scope v6only:0 <->
On client, by nmap -Pn -p 5902 192.168.1.103:
Nmap scan report for 192.168.1.103
Host is up (0.063s latency).
PORT STATE SERVICE
5902/tcp closed vnc-2
Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
Last edited by arch_user_xric (2021-12-13 14:23:06)
Offline
Something is listening on that port, but it's closed for nmap -Pn, what about the general nmap scan?
Are you absolutely sure about the server IP?
If so, is there a local firewall?
iptables -nvL
nft list tables
If not, does the router/switch filter traffic?
Offline
Something is listening on that port, but it's closed for nmap -Pn, what about the general nmap scan?
Are you absolutely sure about the server IP?
If so, is there a local firewall?iptables -nvL nft list tables
If not, does the router/switch filter traffic?
nmap -Pn is working for me (tested for SSH port) while general nmap get:
Nmap scan report for 192.168.11.134
Host is up (0.0056s latency).
All 1000 scanned ports on 192.168.11.134 are in ignored states.
Not shown: 1000 closed tcp ports (conn-refused)
Nmap done: 1 IP address (1 host up) scanned in 1.55 seconds
No record for iptables -nvL, or nft list tables.
I reinstalled tigervnc, yet still same output for ss -tulpen
Offline
Not shown: 1000 closed tcp ports (conn-refused)
Are you absolutely sure about the server IP?
Eg. why are you scanning 192.168.11.134 when you previously stated that the server is 192.168.1.103 ??
Where does that other IP come from? It's not even in the same /24 segment.
Offline
And ~/.vnc/config file:
session=plasma geometry=1920x1080 localhost alwaysshared
Are you trying to connect from the local machine or tunneling over ssh? The localhost directive will enforce localhost only.
Remove the locahost directive from your config. Does your connection work?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Are you trying to connect from the local machine or tunneling over ssh? The localhost directive will enforce localhost only.
graysky is correct, Thanks a lots!
It took me a long time to realize the obvious solution here.
So short version SOLUTION:
edit ~/.vnc/config as follow:
session=plasma
geometry=1920x1080
#localhost
alwaysshared
END of SOLUTION
Thank seth for providing multiple ways to check the ports status from server or client machine. After I commenting the "localhost" , nmap -nP shows that 5901 port which I set for vnc is in open status.
PORT STATE SERVICE
5901/tcp open vnc-1
(P.S.: Before log in via VNC, log out the same user from the physical monitor. Otherwise, VNC only receives a black screen)
Last edited by arch_user_xric (2021-12-13 17:28:04)
Offline
Again, you can tunnel in and keep it for added security.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Again, you can tunnel in and keep it for added security.
Thanks, in the same article https://wiki.archlinux.org/title/TigerVNC, under the subtitle "Accessing vncserver via SSH tunnels", there is a clear instruction for it. (Maybe I should spend more time to read the Wiki next time )
Last edited by arch_user_xric (2021-12-13 17:44:52)
Offline
Pages: 1