Run a remote Linux program graphically in Linux

Source: Internet
Author: User

I just learned how to run a remote Linux program in a graphical way in windows. I am interested and don't want to go to bed. I want to know how to run a remote Linux program in Linux, and it must be graphical. After a long search, I finally found it and successfully tested it in redhat9.

Server: 10.187.82.168

Client: 10.187.82.130 B

That is to say, run the program on B (graphical and text can certainly be better)

Steps:

Perform the following operations on machine B:

1. #: xhost + 10.197.82.168

2. #: SSH 10.187.82.168

3. Enter the root password (for server)

3. #: Display = 10.187.82.130: 0

4 #: gedit

The exciting gedit interface appeared. Now all the operations are running on machine A. Are you very excited? This is a powerful Linux. I found that I like it more and more.

Expand knowledge:

The role of the display environment variable

In Linux/UNIX operating systems, display is used to set where the image is displayed. directly log on to the graphic interface or log on to the command line interface and use startx to start the graphics. The display environment variable is automatically set to 0: 0. At this time, you can open the terminal and output the name of the graphics program (such as xclock) to start the program. The image is displayed in the local window. Enter printenv on the terminal to view the current environment variable. The output result contains the following content:

Display =: 0.0

You can use xdpyinfo to view more detailed information currently displayed.

The display environment variable format is host: NUMA. numb, host refers to the host name or IP address of the xserver. The image is displayed on this host. It can be a Linux/Unix machine that has started the graphic interface, or exceed installed, x-deep/32 and other Windows Operating xserver Windows machines. if the host is empty, the xserver runs on the local machine, and the graphics program (xclient) connects to the xserver using UNIX socket instead of TCP. when a TCP connection is used, numa is the connected port minus the value of 6000. If NUMA is 0, it indicates that it is connected to Port 6000; when the UNIX socket method is used for connection, it indicates the path of the connected UNIX socket. If it is 0, it indicates connecting to/tmp /. x11-unix/x0. numb is almost always 0.

If you use su username or Su-username to switch to another user, and use the command

Export display =: 0.0

When you set the display environment variable and run a graphic program (such as xclock), you will receive the following error:

Xlib: connection to ": 0.0" refused by Server
Xlib: no protocol specified

Error: can t open display: 0.0

This is because xserver does not allow other users' graphics to be displayed on the current screen by default. if you want other users' images to be displayed on the current screen, run the following command as the current login user, that is, the user before switching the identity:

Xhost +

This command will allow other graphical programs started by other users to display the graphics on the current screen.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.