The error “X11 forwarding request failed on channel 0” in macos Sierra

The error ‘X11 forwarding request failed on channel 0’

  1. Edit /etc/ssh/sshd_config by adding the following lines.
# Tanaka added following 4 lines to delete the error message. 2017/July/7
# X11 forwarding request failed on channel 0
#   "/usr/X11/bin/xauth" or "/opt/X11/bin/xauth"
#
X11Forwarding yes
XauthLocation /opt/X11/bin/xauth
XauthLocation /usr/X11R6/bin/xauth
X11DisplayOffset 10
X11UseLocalhost no

The command

ssh -Y owner@lp.harima.riken.jp

gives no warning, but, once this command described in a shell file, like

-rwxr-xr-x 1 owner staff 35 10 22 2015 ~/bin/lp 

has the following line

ssh -Y owner@lp.harima.riken.jp

then, this shell command gives

Warning: No xauth data; using fake authentication data for X11 forwarding.

This warning goes out if you add

XauthLocation /opt/X11/bin/xauth
XauthLocation /usr/X11R6/bin/xauth

in the file /etc/ssh/ssh_config.