之前一直觉得ssh远程启动程序,只能是无界面的字符模式程序,一贯的固定思维导致我当时各种查找远程桌面连接,远程桌面控制,后来用了vnc,putty,折腾了好一番,最终,最近却回到了起点。
着实心累,有时候你不知道真的就是连想都想不到。
原来ssh远程连接的时候,是可以直接启动gui带界面的程序的。
而且特别简单
解决办法:
只需在/etc/ssh/ssh_config文件中修改以下几项。
ForwardX11 yes
ForwardX11Trusted yes
或者有的是/etc/ssh/sshd_config文件:
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
然后重启ssh服务:
$sudo service ssh restart
或者$sudo systemctl restart ssh
当然了,还有一个更加方便的做法,上面的都不用设置:
只需添加一个参数即可,每次登录的时候都使用这条命令就行了。因为参数不多,所以感觉这样已经是最好的连接方式了。
$ssh -X xxx@192.168.2.111
联系客服