How do I su(1) to another user and run an X application?
You need to set your $DISPLAY and allow others to use your console. If you don't, you get a message like "Can't open display". By default, only the user who logged in on console can connect to the display.
To allow another user to connect there are two ways - one easy and one secure (unfortunately, you can't have both):
Easy: As user logged in on console run "xhost +LOCAL:" (This gives permission to connect to the display to anyone logged in on the machine—this includes being able to open windows, read your keystrokes, send keystrokes, etc. Obviously not a good idea if you have other users on the system you don't trust completely.) Starting with Solaris 10, you can also use this safer, more-restrictive format: xhost xhost +si:localuser:username For example: xhost +si:localuser:root
As any other user logged in on the box, run "setenv DISPLAY :0" or "DISPLAY=:0; export DISPLAY", depending on your shell type. This all assumes you're connecting from the same host, for a remote host, change to "xhost +other-hostname" and "setenv DISPLAY PutYourHostnameHere:0"
Safe: As user logged in on console run "xauth list" Look for the line for your hostname followed by ":0" and copy it. As the user you want to grant access to run "xauth" and at the xauth> prompt type "add " and paste the line you copied. Now "setenv DISPLAY hostname:0", making sure you match the way it was listed in the line you copied and pasted.
Easier variation of safe method for special cases: If the other user you want to access your screen is root, and your home directory is either local or on an NFS filesystem exported with root permissions, just have root do this:
setenv XAUTHORITY /home/myuserid/.Xauthority ; setenv DISPLAY :0
(replace "/home/myuserid" with your actual home directory).
于是把USB Mouse直接接在服务器的USB接口上，重启后，问题解决，原来，我是把USB Mouse通过USB转接线放置在面板前的，可能是转接线的问题吧，Solaris识别不出USB鼠标，于是无法进入图形界面了。