Linux远程桌面登录设置
2007-07-26 11:01
651 查看
以前通过ssh命令行远程登录Linux系统,一直想找到Xwindow远程登录方式,都没能找到。
今天看Linux Server Hacks书,有一节是远程GUI连接,是用的是VNC,Ubuntu下用vnc4server比较好。
1. Enable XDMCP
System->Administration->Login Screen Setup
Tab Security->Enable XDMCP
Tab XDMCP--> You can disable "Honor Indirect Requests"
2. Install required packages (vncserver and xinetd)
sudo apt-get install vnc4server xinetd
3. Set the VNC passwd
sudo vncpasswd /root/.vncpasswd
4. Add vnc service to xinetd:
sudo gedit /etc/xinetd.d/Xvnc
Enter this into the new file:
service Xvnc
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = yes
user = root
server = /usr/bin/Xvnc
server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd -extension XFIXES
port = 5901
}
5. Restart xinetd (usually there is no need to reboot, but occasionally it might be required)
sudo /etc/init.d/xinetd stop
sudo killall Xvnc
sudo /etc/init.d/xinetd start
6. That's it! To test that this is working first try to connect from the same machine (the machine we just set up the VNC server on):
vncviewer localhost:1
You should be prompted for the VNC password, and then see the GDM login screen where you can login and start a new X session. If that works, you can now go ahead and try to connect from remote machine using your favorite VNC client (remember to first close the local vncviewer we started above). Remember to use the VNC server machine's domain name or IP address, followed by :1 (e.g. 192.168.0.100:1). If connecting locally as shown above works, but connecting remotely fails, then this means you have a problem with a firewall which is blocking some ports. See the notes below about how to deal with that.
Note about ports: The VNC server set up as shown uses TCP port 5901. If you are using firewall software (e.g. firestarter) on that machine, you need to allow incoming connections on this port. If you are using a router which assigns your machine a private address (e.g. 192.168.0.100) which is not accessible from the internet, then you need to forward TCP port 5901 from the router to this machine.
Note about security: This setup allows any user to start an X-session remotely by logging in using his regular password (after starting the VNC connection using the VNC password), so if the user disconnects without logging out, any other user which knows the VNC password can connect afterwards and resume the same session that the first user started. So if you do not want to log out before disconnecting, it's advisable to at least lock your VNC X-session screen. Also note that while a remote user is connected thru VNC, no other connection will be accepted. An idle VNC client will be disconnected after one hour, but this can be changed by using the "-IdleTimeout" option in the server_args line in /etc/xinetd.d/Xvnc. For example, you can add "-IdleTimeout 300" to change it to 5 minutes.
今天看Linux Server Hacks书,有一节是远程GUI连接,是用的是VNC,Ubuntu下用vnc4server比较好。
1. Enable XDMCP
System->Administration->Login Screen Setup
Tab Security->Enable XDMCP
Tab XDMCP--> You can disable "Honor Indirect Requests"
2. Install required packages (vncserver and xinetd)
sudo apt-get install vnc4server xinetd
3. Set the VNC passwd
sudo vncpasswd /root/.vncpasswd
4. Add vnc service to xinetd:
sudo gedit /etc/xinetd.d/Xvnc
Enter this into the new file:
service Xvnc
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = yes
user = root
server = /usr/bin/Xvnc
server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd -extension XFIXES
port = 5901
}
5. Restart xinetd (usually there is no need to reboot, but occasionally it might be required)
sudo /etc/init.d/xinetd stop
sudo killall Xvnc
sudo /etc/init.d/xinetd start
6. That's it! To test that this is working first try to connect from the same machine (the machine we just set up the VNC server on):
vncviewer localhost:1
You should be prompted for the VNC password, and then see the GDM login screen where you can login and start a new X session. If that works, you can now go ahead and try to connect from remote machine using your favorite VNC client (remember to first close the local vncviewer we started above). Remember to use the VNC server machine's domain name or IP address, followed by :1 (e.g. 192.168.0.100:1). If connecting locally as shown above works, but connecting remotely fails, then this means you have a problem with a firewall which is blocking some ports. See the notes below about how to deal with that.
Note about ports: The VNC server set up as shown uses TCP port 5901. If you are using firewall software (e.g. firestarter) on that machine, you need to allow incoming connections on this port. If you are using a router which assigns your machine a private address (e.g. 192.168.0.100) which is not accessible from the internet, then you need to forward TCP port 5901 from the router to this machine.
Note about security: This setup allows any user to start an X-session remotely by logging in using his regular password (after starting the VNC connection using the VNC password), so if the user disconnects without logging out, any other user which knows the VNC password can connect afterwards and resume the same session that the first user started. So if you do not want to log out before disconnecting, it's advisable to at least lock your VNC X-session screen. Also note that while a remote user is connected thru VNC, no other connection will be accepted. An idle VNC client will be disconnected after one hour, but this can be changed by using the "-IdleTimeout" option in the server_args line in /etc/xinetd.d/Xvnc. For example, you can add "-IdleTimeout 300" to change it to 5 minutes.
相关文章推荐
- linux中mysql设置远程登录
- win 2003-远程桌面登录设置-101
- 如何在 Linux 上使用 x2go 设置远程桌面
- Ubuntu 12.04设置打开远程桌面登录1
- [操作系统设置]禁止指定用户使用远程桌面服务登录
- Linux下实现多用户远程桌面登录
- debian基本设置以及配置XManager远程登录桌面、命令行设置、Xftp上传下载文件
- linux工作记录1-桌面安装以及远程登录
- 如何设置SSH无密码登录远程Linux主机
- Linux 设置ssh远程登录端口
- Linux上远程登录Windows的桌面
- linux下ssh公钥验证的设置和远程登录
- Linux(CentOS 6.3)设置VNC远程桌面连接
- 使用Xmanager 或Hummingbird Exceed登录linux桌面 设置
- 无法远程登录linux上weblogic控制台 防火墙查看和设置
- 【转】【LINUX】远程桌面设置(tsclient,rdesktop)
- 如何在 Linux 上使用 x2go 设置远程桌面
- 虚拟机网络设置及Linux远程登录
- windows下远程登录LINUX桌面
- Linux 安装远程桌面并设置添加分辨率