![为什么startx创建了两个权限文件?](https://linux22.com/image/101998/%E4%B8%BA%E4%BB%80%E4%B9%88startx%E5%88%9B%E5%BB%BA%E4%BA%86%E4%B8%A4%E4%B8%AA%E6%9D%83%E9%99%90%E6%96%87%E4%BB%B6%EF%BC%9F.png)
在我的笔记本电脑中,我安装了一个最小的 X 服务器:
# dpkg -l *xorg* *xinit* | grep '^.i'
ii xinit 1.3.4-1 i386 X server initialisation tool
ii xorg-sgml-doctools 1:1.11-1 all Common tools for building X.Org SGML documentation
ii xserver-xorg 1:7.7+7 i386 X.Org X server
ii xserver-xorg-core 2:1.16.4-1 i386 Xorg X server - core server
ii xserver-xorg-input-evdev 1:2.9.0-2 i386 X.Org X server -- evdev input driver
ii xserver-xorg-video-intel 2:2.21.15-2+b2 i386 X.Org X server -- Intel i8xx, i9xx display driver
#
没有安装显示管理器,也没有桌面环境。仅有的简约的窗口管理器X 服务器通过命令启动startx
。现在startx
调用xauth
两次:
xauth -q -f "$xserverauthfile" << EOF
add :$dummy . $mcookie
EOF
..和
xauth -q << EOF
add $displayname . $mcookie
EOF
/tmp/
第一个在(例如)中创建权限文件/tmp/serverauth.DrFpkBArQq
,第二个在 中创建权限文件$HOME/.Xauthority
。文件内容如下:
# ls -l /tmp/serverauth.DrFpkBArQq
-rw------- 1 root root 48 Dec 31 00:41 /tmp/serverauth.DrFpkBArQq
# xauth -vf /tmp/serverauth.DrFpkBArQq list
Using authority file /tmp/serverauth.DrFpkBArQq
T60/unix:0 MIT-MAGIC-COOKIE-1 16b9dc1ae9969b5a807848b7ade44278
#
# ls -l $HOME/.Xauthority
-rw------- 1 root root 97 Dec 31 00:41 /root/.Xauthority
# xauth -v list
Using authority file /root/.Xauthority
T60/unix:0 MIT-MAGIC-COOKIE-1 16b9dc1ae9969b5a807848b7ade44278
T60:0 MIT-MAGIC-COOKIE-1 16b9dc1ae9969b5a807848b7ade44278
#
为什么有两个权限文件?