How to Run Graphical X Apps Over SSH in Linux
source link: https://www.makeuseof.com/run-graphical-x-apps-over-ssh-linux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to Run Graphical X Apps Over SSH in Linux
Published 4 hours ago
You can run X apps remotely on a Linux server and display their output on your local machine using SSH with X forwarding, Here's how.
While X11 remains the foundation for most Linux desktops, its network transparency, or ability to display output across the network, is one of its unsung features. SSH makes it easy and secure to run Linux GUI apps on a remote machine and display them on your machine.
Why Run Linux Apps Remotely?
Why would you want to run a graphical Linux program on another machine? If you were using a complex scientific computing program like R or Mathematica, you can run it on a heftier machine while still using a lightweight computing environment locally, such as on a Chromebook.
It's also a great way to share technical applications among multiple users by installing them on a central server.
Authorizing X Connections on the Server
To enable X11 connections over SSH, you'll have to enable X11 forwarding on the remote server. This is done using the /etc/ssh/sshd_config file.
You would have to open this file as the root user to edit it. Scroll down to the "X11Forwarding" option and change it to "yes" if it's not enabled already. To restart the SSH server, use the systemctl command:
sudo systemctl restart sshd
You may also need to remove a leading "#" comment character to activate it. Once done, save the file and start the OpenSSH server if it isn't already running. If you're not the administrator, you may have to ask the admin to do this for you.
Running Graphical X Apps Remotely Using SSH
To run your X apps remotely, log in to the remote server over SSH with the -X option, which will enable X forwarding on the client end.
ssh -X username@server
To run your programs, call them from the command line as if you were sitting at a desktop Linux system. If all goes well, you should see the program appear on your desktop, even though it's running somewhere else.
Because X forwarding is slow, it might take a while from when you run the command to when the window opens up. If you need a full desktop or want to run apps faster, you might want to look into another remote display solution like VNC.
If you run into problems, try using the -Y option instead of -X. This will disable some security checks but still allow you to run X apps over SSH. Failing that, make sure that X forwarding is enabled on the remote machine as mentioned above.
Now You Can Run Linux Apps Over SSH
SSH X forwarding makes it easy to run Linux GUI apps remotely. It shows how network-oriented Linux is because you can use remote systems just as if you were sitting right at the keyboard and screen, no matter where you are. Once you have SSH set up, secure remote logins are a snap.
About The Author
David Delony (67 Articles Published)
David is a freelance writer based in the Pacific Northwest, but originally hailing from the Bay Area. He has been a technology enthusiast since childhood. David's interests include reading, watching quality TV shows and movies, retro gaming, and record collecting.
Subscribe to our newsletter
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK