If you use ssh -X, or SecureCRT's X11forward feature, and switch to other UNIX user, X Windows won't able to work. The solution is to copy .Xauthority file from original UNIX user to target UNIX user
Solution with example:
Login to server01 with scchen, with X11forward
$ xauth list
server01/unix:10 MIT-MAGIC-COOKIE-1 6428e2d05f2918e8d7cf56db90836745
server01/unix:11 MIT-MAGIC-COOKIE-1 c65ec856d138e4c849990a8f5a5e7167
server01/unix:12 MIT-MAGIC-COOKIE-1 2044a50a1d58f3887354b41ddc2704fa
server01/unix:15 MIT-MAGIC-COOKIE-1 531619c337025b7396aaf7ab4c593106
server01/unix:14 MIT-MAGIC-COOKIE-1 f322048e33257493e1bc4e9b28f19771
server01/unix:13 MIT-MAGIC-COOKIE-1 32809f04a74f6ad436dc4f3df7fe2c4b
$ echo $DISPLAY # to determine my X Terminal port
localhost:14.0
This mean I need 2nd last line with port 14. Run following command to save to temporary file, readable by new user
$ xauth extract - oas01/unix:14 > /tmp/x_scchen
Now su to 2nd user and add the authorization in
$ sudo su - oracle # or su - oracle
$ xauth merge /tmp/x_scchen
Now can call any X Windows command, like below:
$ echo $DISPLAY
$ export DISPLAY=:14 # Set this if different. It must match what shows under scchen
$ xterm
After completed, remove the authentication
$ xauth remove server01/unix:14
No comments:
Post a Comment