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.

Salamander
link
fedilink
3
edit-2
16d

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.

Thanks for sharing this, @Sal@mander.xyz! I love that this works without having to download extra software too.

Salamander
link
fedilink
116d

You are welcome! Yes, the less the better :-)

@OptimusPrime
creator
link
fedilink
1
edit-2
16d

I’ve set X11Forwarding yes, restarted sshd and connected again with the -X option and executed firefox. 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.

Salamander
link
fedilink
116d

Actually, what is the output of ‘echo $DISPLAY’ when you are logged in via SSH?

@OptimusPrime
creator
link
fedilink
116d
❯ echo $DISPLAY
localhost:10.0
Salamander
link
fedilink
116d

That looks correct

@OptimusPrime
creator
link
fedilink
1
edit-2
16d

❯ 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:

Salamander
link
fedilink
1
edit-2
16d

Ah! Cool! Good job :-)

Salamander
link
fedilink
116d

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.

@OptimusPrime
creator
link
fedilink
2
edit-2
16d

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.

Salamander
link
fedilink
1
edit-2
16d

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.

Create a post

Ask specific questions about how to do something with linux

General linux discussion on lemmy.ml

Create Post From:
lemmy.ml

Community icon by Alpár-Etele Méder,
licensed under CC BY 3.0

  • 0 users online
  • 1 user / day
  • 1 user / week
  • 3 users / month
  • 21 users / 6 months
  • 22 subscribers
  • 18 Posts
  • 42 Comments
  • Modlog