To control one computer from another using the terminal I use ssh, but what if I want to use a GUI program from the other computer in the one I’m using? Both computers are on the same local network.
I’ve seen there are multiple options like VNC and Deskreen. Which is the simplest one?
I’ve been told x2x is the simplest way
I’ve been using x2x for controlling between Linux OSs.
There is also win2x and mac2x, but I’ve never used them.
I don’t think you can get simpler.
If you have already set up passwordless ssh, connecting is as simple as
ssh -XC username@ip x2x -west -to :0.0
then you have control over the the desktop at ‘ip’ from your current keyboard and mouse.
but I get an error when using it
❯ ssh -XC user@192.168.1.135 x2x -west -to :0.0
X11 forwarding request failed on channel 0
x2x - error: can not open display
I’ve also tried TigerVNC. I’ve followed the steps in the Initial setup and Accessing vncserver via SSH tunnels from the TigerVNC arch wiki and now when I try to login a black screen flashes and it takes me to the login page again. So I can’t access the computer. Now I can only access from another computer by ssh or graphically by using the TigerVNC Viewer.
I would like to still be able to login normally to the computer without having to login from another computer.
Log into the computer that you want to forward from and open the configuration file
/etc/ssh/sshd_config
Make sure that the following line is uncommented and has a ‘yes’ setting:
X11Forwarding yes
Reload the settings by restarting the sshd service with:
sudo systemctl restart sshd
Now, from your other PC, try:
ssh -X user@192.168.1.135
And just type ‘firefox’ or whatever browser is installed, and see if that launches. If it works, just close it and launch whatever program you want. If it fails, let me know what the error is.
I’ve set
X11Forwarding yes
, restarted sshd and connected again with the-X
option and executedfirefox
. It’s supposed to have succeeded but I don’t see anything and there is no error. My terminal shows a red prompt when it fails but it isn’t red and yet nothing happened.I’ll read the ArchWiki pages OpenSSH#X11 forwarding and OpenSSH#Daemon management.
On the computer that you are using to SSH from, go to
/etc/ssh/ssh_config
And also set:
ForwardX11 yes
Then try to ssh again.
The same. It doesn’t seem to be needed anyways
enable the ForwardX11 option by either specifying the -X switch on the command line for opportunistic connections, or by setting ForwardX11 to yes in the client’s configuration.
Ah, you are right. This is the configuration I have in my arch and I am able to ssh -X without problem. Not sure what else to suggest - other than maybe trying rebooting both computers.
Actually, what is the output of ‘echo $DISPLAY’ when you are logged in via SSH?
❯ echo $DISPLAY localhost:10.0
That looks correct
❯ firefox --no-remote
Works though. Thanks!
Be careful with some applications as they check for a running instance on the local machine. Firefox is an example: either close the running Firefox instance or use the following start parameter to start a remote instance on the local machine:
Ah! Cool! Good job :-)
Thanks for sharing this, @Sal@mander.xyz! I love that this works without having to download extra software too.
You are welcome! Yes, the less the better :-)
I don’t use desktop on most of the Linux machines I remote into, but if I did I’d use tightvnc-server.
Usually included in the distro, and the app is super straightforward on every platform. I was doing it 20 years ago so it’s easy enough a dumb kid from the sticks could figure it out.