I use X Forwarging over SSH for several things to manage, such as virtual machines with “virt-manager”.
Today, when I wanted to run a graphical tool on one of the servers I kept getting this error.
Error: Can't open display: localhost:10.0
I verified all the possible configurations issued, launched the ssh command with -v argument yet nothing really usable.
Error: Can't open display: localhost:10.0 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype email@example.com reply 0 debug1: channel 0: forcing write
Then I found this thread, I checked, localhost was already in /etc/hosts… but this got me thinking.
I checked the iptables configuration and there was no line to approve traffic on localhost, silly me!
iptables -I INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
Saved the iptables configuration and this solved the problem. Thought this might be a useful trick sometimes 🙂