• ubuntu SSH


    1. 首先在服务器上安装ssh的服务器端。

    $ sudo aptitude install openssh-server

    2. 启动ssh-server。

    $ /etc/init.d/ssh restart

    3. 确认ssh-server已经正常工作。

    $ netstat -tlp

    tcp6    0    0 *:ssh                *:*                   LISTEN     -

    看到上面这一行输出说明ssh-server已经在运行了。

    setp1:

    检查是否安装了ssh

    命令:

    dpkg --list|grep ssh

    出现:

    ii  libssh-4                             0.4.2-1ubuntu1                                        A tiny C SSH library
    ii  openssh-client                       1:5.3p1-3ubuntu4                                      secure shell (SSH) client, for secure access
    ii  openssh-server                       1:5.3p1-3ubuntu4                                      secure shell (SSH) server, for secure access
    ii  ssh-askpass-gnome                    1:5.3p1-3ubuntu4                                      interactive X program to prompt users for a

    如果有openssh-client 和openssh-server       则是已安装

    如果没有安装,可输入以下命令:

    sudo apt-get install openssh

    step2:检测是否启动ssh

    命令:

    ps -ef|grep ssh

    出现:

    root       684     1  0 22:40 ?        00:00:00 /usr/sbin/sshd
    frankwoo  2329  2285  0 22:43 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
    root     31254   684  0 23:49 ?        00:00:00 sshd: root@pts/2 
    root     31408 31341  0 23:58 pts/2    00:00:00 grep --color=auto ssh

    如果有ssh字眼,则表明已启动。

    如果没有启动,输入以下命令:

    /etc/init.d/ssh start

    启动后出现:

    * Starting OpenBSD Secure Shell server sshd                                                                                                          [ OK ]

    表明启动成功

    step3:在Windows环境下,使用putty或secureCRT连接测试

    我这里用的是secureCRT。

    因为要输入IP。这里我在ubuntu里输入命令:

     ifconfig

    因为是使用虚拟机VMware,并以UAT方式连接,因此只需看eth0这部分,命令输入后找到inet字眼,后面的IP就是你在secureCRT新建的connection里需要输入的IP。

    使用 SSH 远程连接运行图形界面程序 

    配置允许X11转发

    代码:

    sudo gedit /etc/ssh/ssh_config ## 设置选项 
    ForwardAgent yes ## 
    ForwardX11 yes ## 
    ForwardX11Trusted yes ## 这个要设置,上面二项可以不要


    连接

    代码:

    ssh -X 用户名@服务器IP "程序名" ## 直接运行一个程序 
    ssh -X 用户名@服务器IP # 或 先登陆再运行程序
    然后用ssh登录后,就可以为了。注意服务端的sshd要重启,在服务器运行的图形界面软件全部都使用服务器的文件,不要搞错了。

    转载自:http://hi.baidu.com/%C3%B4%C3%B4_meme/blog/item/46803b0a3f9d9dbb2fddd456.html

  • 相关阅读:
    CodeForces 1294B Collecting Packages(排序+贪心)
    计算系数(组合数)
    垒骰子(矩阵快速幂)
    蒜头君倒水(矩阵快速幂)
    Buy Tickets POJ
    Billboard HDU
    树状数组求逆序对 附HDU1394
    codeforces 1304D Shortest and Longest LIS
    codeforces 1301C Ayoub's function
    Codeforces 1301B Motarack's Birthday(二分)
  • 原文地址:https://www.cnblogs.com/xiaofengkang/p/2415687.html
Copyright © 2020-2023  润新知