Thursday, June 17, 2010

The X11 forwarding request was rejected!

While trying to use a X11 software like Xmanager to get xterm going with Solaris SPARC 10, I came across this error message

"The X11 forwarding request was rejected!"

Although the /etc/ssh/sshd_config file had correct X11 values like this, it didn't work:

root@oracle2 # cat /etc/ssh/sshd_config | grep X11
# X11 tunneling options
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
root@oracle2 #

After tirelessly searching around google I found out the following solution:

Step 1: Change the ListenAddress parameter in /etc/ssh/sshd_config

By default the ListenAddress is set to :: which is for IPv6. Change it make it look like below

root@oracle2 # cat /etc/ssh/sshd_config | grep ListenAddress
# Multiple ListenAddress entries are allowed.
ListenAddress 0.0.0.0
#ListenAddress ::


Step 2: Add "-4" to the sshd command

I am not sure whats the reason behind doing this, but you need to add a "-4" to the sshd daemon. In case of Solaris SPARC, the sshd service file lies /lib/svc/method/sshd.
- Open the file using vi or your favorite editor.
- Navigate to the 'start') function
- Change the line `/usr/lib/ssh/sshd` to `exec /usr/lib/ssh/sshd -4`
- Save and exit

Step 3: Restart sshd daemon using `svcadm restart ssh`

Check again and you'll be able to login.

Labels: