x11vnc -rfbauth ~/.vnc/passwd -bg -forever -display :0
"-rfbauth ~/.vnc/passwd" specifies the passwd file, "-bg" lets the server run in the background, and "-forever" keeps the server running forever (versus "-once" which stops the server after the viewer exits).
To store the password file, use
x11vnc -storepasswd PATH
and the prompt will ask you to input the password and confirm it. The default path for the file is ~/.vnc/passwd.
Two independent problems:
- On one of my linux box the shift key is disabled somehow. I found the following post which is very helpful (http://www.openg.info/tag/x11vnc-enable-shift-key). It suggested adding "-nomodtweak" which worked!
- On the other one I had the problem via ssh that x11vnc failed to start ":0" and it suggested me using "XAUTHLOCALHOSTNAME=localhost" which didn't help. But it worked fine if I started x11vnc directly on the box. It turned out that x11vnc couldn't find the .Xauthority file which was put in a weird place. All I needed to do was to type "x11vnc -findauth" on the box and use the output location when connecting via ssh. "x11vnc -auth XAUTHORITYPATH ...". Bravo!
- x11vnc has a GUI that makes changing the setting easier. To open the GUI, type
x11vnc -gui connect
It takes effect immediately for the running sessions. Common options include "-share" (whether multiple viewers are allowed for the same session), "-norepeat" (no repeating of a key when pressed for an extended time) and etc.