How to connect Ubuntu remotely

1. 安装 Open ssh

    sudo apt-get install ssh


    这样,我们就可以用 putty + ssh 远程管理 Ubuntu 了。
    说明:PuTTY 是一个小巧精悍的 telnet 和 ssh 终端仿真器。

2. 安装 VNC Server

    sudo apt-get install vnc4server

    vncpasswd

    sudo vi .vnc/xstartup

    说明:我们可以把"twm &"这一行注释掉,
         然后在下面加入一行"gnome-session &",或者是"startkde &",分别启动 GNOME 桌面和 KDE 桌面。


3. 如何使用 SSH 和 VNC

    (1)启动 PuTTY,SSH 到 Ubuntu, 输入用户名和密码

    (2)在终端上执行命令 vncserver
    (3)启动TightVNC Viewer,指定IP地址,连接 Ubuntu



4. 配置Ubuntu的远程桌面连接

    选择
“系统”-“首选项”-“远程桌面”,勾选共享下的2个选项,安全下的2个选项按自己喜欢勾选就可以了。


    这样,我们就可以用另外一种方式 TightVNC Viewer 远程登录 Ubuntu 桌面了。

5. 安装 Telnet service

    sudo apt-get install xinetd telnetd


        sudo vi /etc/inetd.conf
            加入以下一行
            telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd

        sudo vi /etc/xinetd.conf
            加入以下内容:
            # Simple configuration file for xinetd
            #
            # Some defaults, and include /etc/xinetd.d/
            
            defaults
            {

            # Please note that you need a log_type line to be able to use log_on_success
            # and log_on_failure. The default is the following :
            # log_type = SYSLOG daemon info    
            
            instances = 60
            log_type = SYSLOG authpriv
            log_on_success = HOST PID
            log_on_failure = HOST
            cps = 25 30

            }

            includedir /etc/xinetd.d

        sudo vi /etc/xinetd.d/telnet
            加入以下内容:
            # default: on
            # deion: The telnet server serves telnet sessions; it uses \
            # unencrypted username/password pairs for authentication.
            service telnet
            {
            disable = no
            flags = REUSE
            socket_type = stream
            wait = no
            user = root
            server = /usr/sbin/in.telnetd
            log_on_failure += USERID
            }

6. 使用 SSH + VNC远程使用 Ubuntu

fan@fan-desktop:~$ vncserver --help

usage: vncserver [:<number>] [-nohttpd] [-name <desktop-name>] [-depth <depth>]
                 [-geometry <width>x<height>]
                 [-pixelformat rgbNNN|bgrNNN]
                 <Xvnc-options>...

       vncserver -kill <X-display>

fan@fan-desktop:~$ who
fan      tty7         2009-04-05 17:24 (:0)
fan      pts/0        2009-04-05 17:40 (192.168.1.101)
fan@fan-desktop:~$ vncserver

New 'fan-desktop:1 (fan)' desktop is fan-desktop:1

Starting applications specified in /home/fan/.vnc/xstartup
Log file is /home/fan/.vnc/fan-desktop:1.log

fan@fan-desktop:~$ who
fan      tty7         2009-04-05 17:24 (:0)
fan      pts/1        2009-04-05 17:50 (:1.0)
fan      pts/0        2009-04-05 17:40 (192.168.1.101)
fan@fan-desktop:~$ vncserver -kill :1
Killing Xvnc process ID 6784
fan@fan-desktop:~$ who
fan      tty7         2009-04-05 17:24 (:0)
fan      pts/0        2009-04-05 17:40 (192.168.1.101)
posted @ 2011-08-07 08:46  bambreeze  阅读(163)  评论(0编辑  收藏  举报