开机自动运行Ubuntu自带的vino vnc server
vino是Ubuntu自带的vnc,默认登录后才运行,重启后、登录前,是不启动的用下面的办法可以开机后、登录前启动:
1. Edit /etc/gdm/Init/Default – this gets run when gdm starts (at Login Screen)
vi /etc/gdm/Init/Default
2. Add the following line right before exit 0 at the end of the file – Vino server runs when gdm starts up
/usr/lib/vino/vino-server &
Vino server starts up when gdm starts up; however, when username and password is typed in, gdm kill this vino-server meaning VNC connection will be terminated. To prevent this,
3. Edit /etc/gdm/gdm.conf with your favorite text editor
vi /etc/gdm/gdm.conf
4. Find a commented option KillInitClients=true. Uncomment it and change it to false and save it. – this prevents vino-server from being killed right after login
KillInitClients=false
(其实这一步不用改,如果root用户和登录用户设置的vino-preferences和密码都相同,第一次断开后再连一次即可,如果端口或密码不同,断开后,在根据实际的端口和密码再连一次也行,我觉得这样更安全)
Now, you should be able to connect to the machine using VNC
以上四步是网上找的,但总卡在“stuck when protocol being negotiated”,后来发现vino-preferences设置的是普通用户,但在Ubuntu中,登录前启动的gdm是root用户,所以要设置root用户的vino-preferences。于是sudo vino-preferences,设置好后,成功:第一次连接是用root用户,输入密码和对应端口后看到登录界面;登录进去后,root的vnc连接断开,再连一次,这时用的是普通用户,也就是刚才输入的用户名对应的用户,端口和密码都可以和刚才不一样。
这样,不用担心重启后连不上Ubuntu的图形界面了
Labels: Linux, Operation and Maintenance