免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1460 | 回复: 0
打印 上一主题 下一主题

ubuntu安装ssh服务 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-14 13:58 |只看该作者 |倒序浏览

ubuntu默认并没有安装ssh服务,如果通过ssh链接ubuntu,需要自己手动安装ssh-server。判断是否安装ssh服务,可以通过如下命令进行:
[email=xjj@xjj-desktop:~$]xjj@xjj-desktop:~$[/email]
ssh localhost   
  • ssh: connect to host localhost port 22: Connection refused   xjj@xjj-desktop:~$ ssh localhost
    ssh: connect to host localhost port 22: Connection refused
    如上所示,表示没有还没有安装,可以通过apt安装,命令如下:
    [/url]

  • xjj@xjj-desktop:~$ sudo apt-get install openssh-server  xjj@xjj-desktop:~$ sudo apt-get install openssh-server
    系统将自动进行安装,安装完成以后,先启动服务:
    [url=http://exceljava.javaeye.com/blog/367193#]


  • xjj@xjj-desktop:~$ sudo /etc/init.d/ssh start  xjj@xjj-desktop:~$ sudo /etc/init.d/ssh start

    启动后,可以通过如下命令查看服务是否正确启动
    [/url]

  • xjj@xjj-desktop:~$ ps -e|grep ssh   
  • 6212 ?        00:00:00 sshd  xjj@xjj-desktop:~$ ps -e|grep ssh
    6212 ?        00:00:00 sshd

    如上表示启动ok。注意,ssh默认的端口是22,可以更改端口,更改后先stop,
    然后start就可以了。改配置在/etc/ssh/sshd_config下,如下所示。

  • xjj@xjj-desktop:~$ vi /etc/ssh/sshd_config   
  • # Package generated configuration file   
  • # See the sshd(8) manpage for details   
  • # What ports, IPs and protocols we listen for  
  • Port 22  xjj@xjj-desktop:~$ vi /etc/ssh/sshd_config
    # Package generated configuration file
    # See the sshd(8) manpage for details
    # What ports, IPs and protocols we listen for
    Port 22

    最后,应该是连接的时候了。请看如下命令:
    [email=xjj@xjj-desktop:~$]xjj@xjj-desktop:~$[/email]
    ssh exceljava@192.168.158.129  

    本文来自ChinaUnix博客,如果查看原文请点:[url]http://blog.chinaunix.net/u3/99918/showart_2051886.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP