Ubuntu – View images over active Linux SSH session


How would you view a JPG over SSH? I have tried ForwardX11, but I get an error saying 'X11 forwarding request failed on channel 0'. I can use vim, but display, eog, ty-and-imgcat have all failed with the error 'Command not found'. Could anyone give me a hand? Also, the JPG has no extension – M5KDAN44.


Best Answer

I assume you are using Ubuntu Desktop to connect to the Ubuntu server. Since the remote computer is an Ubuntu server, it does not have any graphical interfaces like x.org. Therefore you cannot use X forwarding from the server to the desktop. Here is an alternate approach to viewing the jpeg file from the Ubuntu server. We will use sftp which in turn uses ssh.

Setup sftp using Nautilus

Open Nautilus and find the Menu item "Other Locations". At the bottom find Connect to Server:

enter image description here

Under Server Address Enter:


The part after // is as you would use to ssh to the server.

Press Connect. You will see a password dialog box:

enter image description here

Enter the password associated with laptop_user_id and select if you want the password is to be remembered or not. Again click Connect.

Now you should see your home folder of the laptop.

Notice there is a new entry under Network on the left panel of Nautilus that begins with server_user_id. Right click on it and choose "Add Bookmark" to create a permanent bookmark for your server's home folder in the Nautilus of the Desktop.

Navigate to your file

Navigate to the folder where you have the jpeg file you want to view:

enter image description here

As the file does not have any extension Nautilus will not recognize it as a jpeg file yet. It will show up as a generic binary file as seen above.

Rename the file

Right click on the file and select rename

enter image description here

Add the file extension jpg to the end of the filename

enter image description here

Double click on the renamed file

enter image description here

The jpeg file from the server will now open in the default image file viewer in the local desktop.

Hope this helps

Related Question