Wednesday, October 20, 2010

FreeBSD Serial (49): access to X Window

X server implementation of the program is located in / usr/X11R6/bin directory, and uses a symbolic link "X", pointing to the implementation of specific procedures, such as XF86_VGA16 or XF86_S3V so. Therefore can directly enter the X command to set a good X server starts, the system will enter the graphics state, and the emergence of an X-shaped mouse pointer move, but no other reaction. This is because the X server is only responsible for input and display the specific address of the user's input from the other X client is responsible for, and directly start the X server does not start any X clients, and thus can not handle any user input.

Manually start the X Window

Therefore, to use graphical interface, processing power, start the X server at the same time should also start the X client to be responsible for responding to user input. This task can startx or xinit by shell procedures to achieve, both programs can start X at the same time, start the X Window window management procedures, and other X program.

startx and xinit default view user personal directory. xinitrc file, in this document should contain all X client startup command. Simple. Xinitrc may only contain a command to start a terminal emulation xterm, you can include a series of commands to start several programs, create a beautiful X environment. Want your own custom X Window operating environment users can manually create and modify this file to get a different user interface.

xmodmap-e''keysym Alt_L = Meta_L Meta_L''
xterm &
xearth &

In this example, the implementation of the xmodmap keyboard to modify the definition of X, then the implementation of xterm in the background to provide a simulation of the terminal, set the X Window implementation xearth the background, and finally at the front desk to perform a simple window manager twm. Was placed in front window manager implementation, so that when out of the window manager will quit the X server implementation.

By default, the user did not create this. Xinitrc file, so xinit command can only start a xterm terminal emulator, but not perform any other X program, does not implement window manager. Therefore, the direct use xinit to start X Window just have a terminal window, move the mouse on it later, can enter the command to perform other operations. Users who want to start the window manager or other procedures must be in a terminal window, enter the appropriate command.

Because there are several windows in X Window, but only one is called "focus" of the window to receive input. X Window default location using the mouse to select the input focus window, of course, some other window manager can also switch the keyboard input focus window.

But even if does not exist. Xinitrc file, use startx can start the window manager and several X client program, this is because startx found that users personal directory does not exist. Xinitrc file, to use the system in the / usr/X11R6/lib / X11/xinit/xinitrc procedures as xinit startup file (startx is a shell script that calls xinit). So change the system xinitrc file, you can not create all. Xinitrc user still enjoys a start file to start the X Window System. Since FreeBSD is a multi-user system, this configuration file can simplify start the initial configuration tasks for each user. In the user's understanding deepened after X Window, you can further configure their own startup files to customize their use of X Window style.

XDM system login

startx or xinit must first log on after the console, enter the appropriate command to enter the X Window environment. Another method for the pre-start the X Window system, log into the system under X Window. This approach is to use xdm to achieve.

To root user login, the command line input xdm, the system immediately start the X server, and start the appropriate access management program, the X Window on a login window appears, allowing all users to log into the system.

After the user login authentication, xdm will need to start the login session for the user. xdm on the implementation of the user identity / usr/X11R6/lib/X11/xdm/Xsession file, and then implementation of the user personal directory. xsession file. Personal directory. Xsession file. Xinitrc file like it is a standard shell script, the following is an example.

PATH = / usr / bin: / usr / sbin /: / usr/X11R6/bin: / usr / local / bin
xrdb-load. Xdefaults
xterm &
xearth &

The file with the. Xinitrc file difference is that, as. Xinitrc is after the user logs used by the xinit, so including the PATH environment variables have been included in the user's. Profile and other documents in the settings right, but by xdm Log in user is not running. profile settings, such as file, it must be. xsession set PATH and other environmental variables, to correctly find all executable files, or it must use the absolute path to start the application.

Another difference is that the individual directory. Xsession file must exist, the user can enter through the normal XDM X Window, an error will occur if the login process. For xinit speaking,. Xinitrc is not required if the. Xsession problems of implementation, the user does not login from xdm to log into the system interface. At this point the user can check the appropriate directory. Xsession-errors file, this file will contain the implementation. Xsession error message.

In FreeBSD 3.1-RELEASE There is a small problem,. Xsession is necessary to have the executable attribute, otherwise it can not be properly implemented, this problem has been fixed in 3.2-RELEASE. Can. Xsession-errors in the error message to find the error.

Log in using the root system first and then hand the implementation of a debugging xdm was just a means of implementation, if we were to allow users to log in using xdm, should be run automatically at boot time xdm, the simplest way is to / usr/X11R6/etc / rc.d directory, add an executable file, such as name, and use the chmod + x so that it can be executed, the simplest form of for the following:

#! / Bin / sh
echo "Enter xdm"
/ Usr/X11R6/bin/xdm

This system will start directly after the start xdm, into the X Window and display a login screen waiting for user login. xdm with a daemon running in the background, every time the user will automatically restart after the withdrawal of another login screen that allows users to log on.

Of course, can also xdm command into the rc.local file, but use a separate startup file startup file so much more neat and clear.

Start Xdm Another way is to change the / etc / ttys settings, the system will ttys file in the terminal configuration in the corresponding start the corresponding program, so you can spare in a console terminal, usually the fourth Virtual Console ttyv3, start xdm.

ttyv3 "/ usr/X11R6/bin/xdm-nodaemon" xterm on secure

ttys specified in the process of re-generated with characteristics of each process to be reinstated immediately after withdrawal. So you can not use xdm's own daemon function, and let the system to maintain Xdm automatically. Need to use-nodaemon parameters of the normal process xdm to run.

Remote start X client:

X protocol X Window own support network is a distributed architecture. If FreeBSD and other Unix users connected through the network, you can run X on a client computer, and will run the X window server on another computer.

Because a computer can run multiple X servers, each server will support multiple displays, then the X client program must confirm that a certain computer server on a single screen display, it must include the computer address, X server serial number and display number to uniquely identify the location of a display of resources, such as xserver: 0.0, typically a computer and not excessive in the X server, the X server does not have multiple displays, so you can the location of the display of resources to simplify the general use of xserver: 0 representation.

This representation can sign a remote X server, display position, when the implementation of the X client program, you need to use the display in the command line option to tell the X client program that shows the location of parameters.

xclient $ xterm-display xserver: 0 &

Or by setting the DISPLAY environment variable to achieve the same purpose.

xclient $ DISPLAY = xserver: 0; export DISPLAY
xclient $ xterm &

Both methods are called xserver to the X server on the computer sent the request, but can also normally out the window must be the X server's permission. By default, the X server with access control, standard access control allows only X clients with access permission, and subroutines to access the X server's resources, and other X clients can not use the X server resources. When users start the X server startx and xinit, or when logged into the system through xdm, then start the X client program on the inheritance of the original access. However, the network started X clients, use the X server resource on the subject of this access control, and do not start properly.

Control of X server access control command for the xhost, to enable the display of resources can be xclient xserver on the procedures used by X clients, you must already have the ability to access X server X-terminal emulation run the following command:

xserver $ xhost xclient

Xhost command allows xclient above the X client computer using the X server, you can also use + as xhost implementation parameters, which will allow any X client programs to access X server, and therefore there are some security issues. If you use the X server through the network the situation more, you can put the corresponding xhost command. Xinitrc or. Xsession, the automatic settings.

xserver $ rsh xclient / usr/X11R6/bin/xterm-display xserver: 0
wb's password:

The above is a use rsh on a remote computer running X program, which will open the window back to X server example, in the implementation of this command should be executed before the xhost client to open access.

Recommended links:

The basics of Intrusion detection rules

DAT to 3GP


DivX To Zune

Evaluate Calculators And Converters

DOS, Also Use Flash Tips

Barbed words! Photoshop special effects MAKE the word cactus


12 Large Companies In 2007-2008 Compared The Welfare State

QTP descriptive language experience

Log Multiple Gmail Accounts At The Same Time - Firefox Extension

"Batman Arkham asylum" after playing a little bit of getting

Nothing to fall back Tencent Sogou input method of unfair competition

How Correct Is A Precision Gold Metal Detector

No comments:

Post a Comment