以前ubuntu上不但装过vnc,还配置成功过一次,但是登陆之后桌面会变成gnome一个奇奇怪怪的样子。所以这次重新搞。主要是通过x11vnc,使得远程访问能够完美还原unity桌面。
最近升级18.04,全gnome了,于是follow: http://c-nergy.be/blog/?p=11187 搞定了。
1. terminal:
sudo apt-get install x11vnc
2. set password:
sudo x11vnc --storepasswd /etc/x11vnc.pass
3. 对14.04及以下的ubuntu可以这样设置开机启动,而不是登陆ubuntu后才启动
sudo vi /etc/init/x11vnc.conf
content (4 lines):
start on login-session-start
script
/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
end script
reboot the computer to start the service.
但是对于用systemd而不是init的ubuntu15.04我还没有尝试成功,所以就每次执行下一个步骤。
4. I want to check it by now, so I just use this command:
sudo /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
5. 为了更安全的连接ubuntu, following the instruction of this. 但是最后几步不可以仿照,所以我只把需要仿照的步骤列一下
- 5.1 download the normal stand-alone version of PuTTY
- 5.2 Under “Host Name”, enter the IP address or host name of the computer you want to connect to and the port that the SSH server is on (22 by default).
- 5.3 Then go to the “Connection>SSH>Tunnels” category. You need to create a tunnel from port 5900 to 127.0.0.1:5900. You can then save these settings back on the main screen so you don’t have to configure PuTTY every time. Click open and log in.
6. 接下来在windows下载vncviewer,建立一个连接,地址写:127.0.0.1::5900 搞定。
参考:https://blog.youkuaiyun.com/lijiecong/article/details/50750879
http://seb.so/vnc-from-boot-without-logging-in-ubuntu-lubuntu-xubuntu-and-mint-lmde/
http://tombuntu.com/index.php/2007/06/27/remote-access-from-windows-x11vnc/