On the server
Edit /etc/ssh/sshd_config
:
AllowAgentForwarding yes
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
Restart the sshd daemon:
sudo service sshd restart
# or
sudo /etc/init.d/ssh restart
# or whatever way of restarting your box services works on your distro...
Install the packages (Ubuntu/Debian):
apt-get -y update
apt-get -y install xauth
Install the packages (RHEL/CentOS):
yum -y update
yum -y install xauth
Now exit the server:
exit
On the client
Set the DISPLAY
environment variable locally:
export DISPLAY=:0.0
and start a trusted SSH connection to the server:
ssh -Y $ssh_user@$ssh_server
Verify success with a graphical app. Install an app supporting X11 forwarding, if needed. As an example:
yum -y install xclock
and action:
for i in {1..3} ; do bash -c "xclock &" ; done ;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…