UNIX/コマンド/X/xauth

Top > UNIX > コマンド > X > xauth

$accept_char = "0123456789abcdef";
srand(time|$$);
for ($i=0; $i < 32; $i++) {
    $key .= substr($accept_char, rand(length($accept_char)), 1);
}
…
system "$XPATH/bin/xauth add $hostname:0 MIT-MAGIC-COOKIE-1 $key";
system "$XPATH/bin/xauth add $hostname/unix:0 MIT-MAGIC-COOKIE-1 $key";
…
system "$XPATH/bin/xinit $clientarg -- /usr/X11R5/bin/Xrfx $serverarg -auth $home/.Xauthority";
% Xinit

% xauth add [hostname]:[display#] MIT-MAGIC-COOKIE-1 [32桁の16進数字(COOKIE)]

% xauth list
% xauth list [hostname]:[display#]
[hostname]:0   MIT-MAGIC-COOKIE-1   992d409462631c5b5930ccce7c8d79f0

% xauth remove [hostname]:[display#]
% xauth add [X_server_host]:[display#] MIT-MAGIC-COOKIE-1 [COOKIE]

/var/X11/xdm/xdm-config
DisplayManager*authorize: on
/etc/sxdm/sxdm-config
DisplayManager*authorize:       false

#!/bin/sh
hostname=`hostname`
key=`awk 'BEGIN{srand(); for(i=0;i<32;i++){printf "%1x", rand()*16;}}'`
xauth add $hostname:0 MIT-MAGIC-COOKIE-1 $key
xauth add $hostname/unix:0 MIT-MAGIC-COOKIE-1 $key


xrea