hlo*_*dal 6 ssh xorg forwarding xauth
使用登录时,ssh -Y remotehost我收到以下错误消息:
/usr/bin/xauth: /home/hlovdal/.Xauthority 不可写,更改将被忽略
和 xclock 和类似的无法启动。尽管有错误消息,但 .Xauthority 文件的权限没有任何问题。
(hlovdal) remotehost:~>xclock
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0
(hlovdal) remotehost:~>ls -l /home/hlovdal/.Xauthority
-rw-------. 1 hlovdal hlovdal 70 Jul 25 23:30 /home/hlovdal/.Xauthority
(hlovdal) remotehost:~>
Run Code Online (Sandbox Code Playgroud)
这里的原因可能是什么?
(这是在我的两台笔记本电脑之间,我之前来回嘘了数百次。)
更新:
在进一步调试时,xauth 再次抱怨它无法写入 .Xauthority 这没有意义,因为我的用户可以写入该文件,出于好奇,我运行了 strace 以查看它究竟试图做什么。
(hlovdal) remotehost:~>xauth list
xauth: /home/hlovdal/.Xauthority not writable, changes will be ignored
(hlovdal) remotehost:~>strace -oout -f -s9000 xauth list
xauth: error in locking authority file /home/hlovdal/.Xauthority
(hlovdal) remotehost:~>tail out
16634 brk(0xf03000) = 0xf03000
16634 brk(0) = 0xf03000
16634 rt_sigaction(SIGINT, {0x4050d0, [INT], SA_RESTORER|SA_RESTART, 0x3957035350}, {SIG_DFL, [], 0}, 8) = 0
16634 rt_sigaction(SIGTERM, {0x4050d0, [TERM], SA_RESTORER|SA_RESTART, 0x3957035350}, {SIG_DFL, [], 0}, 8) = 0
16634 rt_sigaction(SIGHUP, {0x4050d0, [HUP], SA_RESTORER|SA_RESTART, 0x3957035350}, {SIG_DFL, [], 0}, 8) = 0
16634 rt_sigaction(SIGPIPE, {0x4050d0, [PIPE], SA_RESTORER|SA_RESTART, 0x3957035350}, {SIG_DFL, [], 0}, 8) = 0
16634 stat("/home/hlovdal/.Xauthority-c", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
16634 open("/home/hlovdal/.Xauthority-c", O_WRONLY|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)
16634 write(2, "xauth: error in locking authority file /home/hlovdal/.Xauthority\n", 66) = 66
16634 exit_group(1) = ?
(hlovdal) remotehost:~>ls -l .Xauthority*
-rw-------. 1 hlovdal hlovdal 70 Jul 25 23:30 .Xauthority
-rw-------. 2 hlovdal hlovdal 0 Jul 26 01:26 .Xauthority-c
-rw-------. 2 hlovdal hlovdal 0 Jul 26 01:26 .Xauthority-l
(hlovdal) remotehost:~>
Run Code Online (Sandbox Code Playgroud)
这更好地解释了为什么 xauth 失败,因为它无法创建 .Xauthority-c。但是删除这两个可能过时的文件无济于事,它们会在下次 ssh 登录时重新创建。remotehost 中的 syslog 包含以下与 ssh 登录相关的内容。
sshd[17551]: Accepted publickey for hlovdal from x.x.x.x port 36545 ssh2
sshd[17552]: fatal: mm_request_receive: read: Connection reset by peer
sshd[17551]: pam_unix(sshd:session): session opened for user hlovdal by (uid=0)
Run Code Online (Sandbox Code Playgroud)
这个 mm_request_receive 错误信息以前从未出现过,所以我想有进一步调试的线索。
小智 18
在 Ubuntu 12.04 上同步我的主文件夹后,我遇到了同样的问题。我使用以下命令解决了它:
rm ~/.Xaut*
Run Code Online (Sandbox Code Playgroud)
然后我注销并重新登录。出现以下警告:
/usr/bin/xauth: file /home/iranice/.Xauthority does not exist
Run Code Online (Sandbox Code Playgroud)
之后,Linux 会.Xauthority自动创建文件。我注销并重新登录,一切正常。
| 归档时间: |
|
| 查看次数: |
52442 次 |
| 最近记录: |