Run a remote linux program graphically in linux

Source: Internet
Author: User
Run the remote linux Program-linux Enterprise Application-Linux server application in Linux. For more information, see the following section. 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.
Related Article

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.