如何通过 SSH 连接打开并查看图像文件?

如何通过 SSH 连接打开并查看图像文件?

我正在使用

  • Ubuntu 14.04
  • SSH 连接到另一台 Ubuntu 14.04 机器

我正在尝试做什么

  • 从控制台查看/显示图像的内容(,,.png... )。.jpeg.bmp

我正在使用 Ubuntu 连接到 VPS,我需要知道更新图像文件后它是否发生变化,所以我需要通过 ssh 打开/显示图片。

我怎样才能做到这一点?

答案1

如果您想使用 GUI 应用程序ssh,您需要使用-X-Y选项(使用-Y):

 -X      Enables X11 forwarding.  This can also be specified on a per-host
         basis in a configuration file.

         X11 forwarding should be enabled with caution.  Users with the
         ability to bypass file permissions on the remote host (for the
         user's X authorization database) can access the local X11 display
         through the forwarded connection.  An attacker may then be able
         to perform activities such as keystroke monitoring.

         For this reason, X11 forwarding is subjected to X11 SECURITY
         extension restrictions by default.  Please refer to the ssh -Y
         option and the ForwardX11Trusted directive in ssh_config(5) for
         more information.
 -Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are not
         subjected to the X11 SECURITY extension controls.

因此,例如,要使用eog显示远程图像/path/to/file.png,您可以这样做

ssh -Y [email protected] eog /path/to/file.png

相关内容