PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
I will share with you the error I encountered related to the X server while trying to connect to my virtual machine via PuTTY, as well as the solution.
Even though I enabled X11 forwarding and set the X display location to localhost:0.0
in PuTTY connections, I encountered the following error after connecting to PuTTY as the root user:
root@xxx.xxx.x.xx’s password: Activate the web console with: systemctl enable — now cockpit.socket Last login: Tue Sep 3 11:07:26 2024 from xxx.xxx.x.xx PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
This error indicates that PuTTY’s X11 forwarding is not properly configured, or it is unable to connect to the X server. To resolve this, start Xming and check if the xclock
command works. If it doesn't:
- First, check the
DISPLAY
variable. You can do this by using theecho $DISPLAY
command. It should return a value likelocalhost:10.0
. If it doesn't, you need to set it manually. If it is empty, you can temporarily set it like this:
>> export DISPLAY=localhost:10.0
- You should ensure that Xming is still running.
- You should also check the firewall, as firewall restrictions can block X11 forwarding.
- Additionally, verify if the x11 packages are installed on your server. If not:
>> yum install xorg-x11-apps -y
>> apt-get install x11-apps -y
You can install them using the commands.
- If the packages are not being downloaded, on systems like Oracle Linux, certain repositories may need to be enabled to install additional packages. Specifically, enabling the CodeReady or EPEL repository can provide access to packages like
xorg-x11-apps
.
>> dnf install oracle-epel-release-el8
>> dnf config-manager — set-enabled ol8_codeready_builder
>> dnf install xorg-x11-apps -y
If xorg-x11-apps
still cannot be installed, you can try installing more basic X11 packages. For example:
>> yum install xclock -y
These steps should resolve your issue.
I hope this post has been helpful. See you in my next post. You can reach me through my LinkedIn account.