dscl doesn't work from inside re-attached screen
I am on Mac OS X 10.5.8. I am not sure exactly when this started happening, but I find that when I re-attach to a screen session that was started from an ssh session, anything relying on dscl (directory services), or the underlying getent stuff, fails.
If I start the session on that machine in Terminal, everything works. Only remotely started screen sessions have problems when re-attached.
$ dscl . -list /Users
>> works
$ screen
$ dscl . -list /Users
>> works
[detached]
$ dscl . -list /Users
>> works
$ screen -x
$ dscl . -list /Users
Operation failed with error: eServerNotRunning
Also failing:
$ whoami
504
I have rebooted, debugged, and googled for about 6 hours now with no luck.
It is really painful since it affects lots of applications (ssh, git, rake, etc).
I am curious if this is aff开发者_Python百科ecting anyone else, or if anyone has any idea how to fix it.
Here's a sample within two accounts on the same machine (OS 10.5.8). Could not test it while on ssh, sorry. Consider:
1st account = one
2nd account = two
Assume being logged to "one":
one$ screen
one$ dscl . -list /Users >> works
Now while logged to "two":
two$ su - one
Password:
one$ script /dev/null
Script started, output file is /dev/null
bash-3.2$ screen -x
bash-3.2$ dscl . -list /Users >> works
That's it ;)
If curious: Stackoverflow: Why does redirecting 'script' to /dev/null/ allow 'screen' to work while su'ed as another user?
精彩评论