Xclock does not work after switch to another user
suppose that user1 can run xclock and after switch to user2 xclock does not work
does not matter if user1 or user2 is root
you need to import the following values from user1 to user2
For KSH Shell
$user1:/> xclock
$user1:/>su - user2
$user2:/> xclock
Error: Can't open display:
$user2:/>exit
$user1:/>xauth list
hostname/unix:10 MIT-MAGIC-COOKIE-1 630b2e7a7a794022834b0783b6f471fa
hostname/unix:11 MIT-MAGIC-COOKIE-1 dbdcd6d69b9b3002484c4ea1e29a2ad5
hostname/unix:12 MIT-MAGIC-COOKIE-1 745ca626d4ef81101ef744589b4cfb09
$user1:/>echo $DISPLAY
localhost:11.0
(Hint : choose the matching values)
$user1:/>su - user2
$user2:/>xauth add hostname/unix:11 MIT-MAGIC-COOKIE-1 dbdcd6d69b9b3002484c4ea1e29a2ad5
$user2:/>export DISPLAY=localhost:11.0
$user2:/> xclock
For CSH Shell
$user2:/>xauth add hostname/unix:11 MIT-MAGIC-COOKIE-1 dbdcd6d69b9b3002484c4ea1e29a2ad5
$user2:/>setenv DISPLAY localhost:10.0
$user2:/> xclock
does not matter if user1 or user2 is root
you need to import the following values from user1 to user2
For KSH Shell
$user1:/> xclock
$user1:/>su - user2
$user2:/> xclock
Error: Can't open display:
$user2:/>exit
$user1:/>xauth list
hostname/unix:10 MIT-MAGIC-COOKIE-1 630b2e7a7a794022834b0783b6f471fa
hostname/unix:11 MIT-MAGIC-COOKIE-1 dbdcd6d69b9b3002484c4ea1e29a2ad5
hostname/unix:12 MIT-MAGIC-COOKIE-1 745ca626d4ef81101ef744589b4cfb09
$user1:/>echo $DISPLAY
localhost:11.0
(Hint : choose the matching values)
$user1:/>su - user2
$user2:/>xauth add hostname/unix:11 MIT-MAGIC-COOKIE-1 dbdcd6d69b9b3002484c4ea1e29a2ad5
$user2:/>export DISPLAY=localhost:11.0
$user2:/> xclock
For CSH Shell
$user2:/>xauth add hostname/unix:11 MIT-MAGIC-COOKIE-1 dbdcd6d69b9b3002484c4ea1e29a2ad5
$user2:/>setenv DISPLAY localhost:10.0
$user2:/> xclock
Comments
Post a Comment