客户端需要安装openssh-client,服务器需要安装openssh-server,一般情况下默认都是安装好的。

服务器端设置:/etc/ssh/sshd_config中,修改这一行,修改后是这样的:

X11Forwarding yes

客户端设置:/etc/ssh/ssh_config中,修改三行,修改后如下:

ForwardAgent yes

ForwardX11 yes

ForwardX11Trusted yes

修改完配置文件,在客户端终端执行

xhost + server_IP

ssh -X root@server_IP

export DISPLAY=client_IP:0.0

接着在客户端执行图形程序,图形界面便会转发过来了。

即便是服务器没有安装图形界面,只要安装了带有图形界面的程序,就可以进行转发,比如在服务器上安装Firefox,在客户端执行firefox,本地就会打开浏览器窗口。

Leave a Reply

Your email address will not be published. Required fields are marked *