Prev | Current Page 275 | Next

Chris Tyler

"X Power Tools"

8).
To remove a magic cookie from a ~/.Xauthority file, use the remove command:
red$ xauth remove blue:0
Initial cookies are generated by the display manager or by the program starting the X
server (such as startx). If you wish to start an X server in your own script and use
magic cookies for access control, use the mcookie command to make a cookie and
then use xauth to store it in ~/.Xauthority before starting the X server. Here is an
example:
#!/bin/bash
# Start an X server with a magic cookie
export DISPLAY=:8 # Choose a display number
xauth add $DISPLAY . $(mcookie) # Create cookie, save in ~/.Xauthority
X -terminate $DISPLAY & # Start the X server
SERVERPID=$! # Remember the server process ID
# Run any clients here...
mwm &
kcalc &
soffice &
wait $SERVERPID # Wait for server to finish
xauth remove $DISPLAY # Remove the cookie from the file
If your system doesn??™t have mcookie, you can make a random cookie from a hash of
random data??”just change the first xauth line to read:
xauth add $DISPLAY . $(dd if=/dev/random bs=10k count=1 2>/dev/null|
md5sum|cut -c1-32)
Magic cookies are read by the X server from ~/.Xauthority only when the server starts
up. Clients are subject to access control only when they first connect to the server;
once connected, they can remain connected for any length of time without further
access control checks.


Pages:
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
SPA internet torby reklamowe zaproszenia slubne utylizacja komputerów