网上有很多介绍在Ubuntu下开启SSH服务的文章,但大多数介绍的方法测试后都不太理想,均不能实现远程登录到Ubuntu上,最后分析原因是都没有真正开启ssh-server服务。最终成功的方法如下:

sudo apt-get install openssh-server

Ubuntu缺省安装了openssh-client,所以在这里就不安装了,如果你的系统没有安装的话,再用apt-get安装上即可。

然后确认sshserver是否启动了:

ps -e |grep ssh

如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明ssh-server已经启动了。

ssh-server配置文件位于/ etc/ssh/sshd_config,在这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号,如222。然后重启SSH服务:

sudo /etc/init.d/ssh restart

ssh连接:ssh linuxidc@192.168.1.1

摘自:http://www.linuxidc.com/Linux/2010-02/24349.htm

久!

2011-08-23 12:57 上传

下载附件 (126.46 KB)

后来找到了http://www.unixtutorial.org/2009 ... re-shell-in-ubuntu/,马上如有天助,跟我遇到的问题都一样!原来是要输入yes阿!我习惯性的输入的都是y,哎!看样子也的看清楚答问题阿!

SSH (Secure SHell) is possibly the best way to remotely access a Unix system – it's very secure thanks to automatic encryption of all the traffic, and it's also quite universal because you can do all sorts of things: access remote command line shell, forward graphics session output, establish network tunnels and set up port redirections. Today I'm going to show you how to get started with SSH in Ubuntu.

Installing SSH server in Ubuntu

By default, your system will have no SSH service enabled, which means you won't be able to connect to it remotely using SSH protocol (TCP port 22). This means that installing SSH server will be one of the first post-install steps on your system.

The most common SSH implementation is OpenSSH server, and that's exactly what you want to install.

Log in with your standard username and password, and run the following command to install openssh-server. You should be using the same username that you specified when installing Ubuntu, as it will be the only account with sudo privileges to run commands as root:

ubuntu$ sudo apt-get install openssh-server

[sudo] password for greys:

Reading package lists... Done

Building dependency tree

Reading state information... Done

Suggested packages:

rssh molly-guard openssh-blacklist openssh-blacklist-extra

The following NEW packages will be installed:

openssh-server

0 upgraded, 1 newly installed, 0 to remove and 75 not upgraded.

Need to get 285kB of archives.

After this operation, 782kB of additional disk space will be used.

Get:1 http://ie.archive.ubuntu.com jaunty/main openssh-server 1:5.1p1-5ubuntu1 [

285kB]

Fetched 285kB in 0s (345kB/s)

Preconfiguring packages ...

Selecting previously deselected package openssh-server.

(Reading database ... 101998 files and directories currently installed.)

Unpacking openssh-server (from .../openssh-server_1%3a5.1p1-5ubuntu1_i386.deb) .

..

Processing triggers for ufw ...

Processing triggers for man-db ...

Setting up openssh-server (1:5.1p1-5ubuntu1) ...

Creating SSH2 RSA key; this may take some time ...

Creating SSH2 DSA key; this may take some time ...

* Restarting OpenBSD Secure Shell server sshd                           [ OK ]

Verifying your SSH server works

While you're still on your local desktop session, you can use the ps command to confirm that SSH daemon (sshd) is running:

ubuntu$ ps -aef | grep sshd

root     24114     1  0 15:18 ?        00:00:00 /usr/sbin/sshd

Now that you see it's there, it's time to try connecting:

ubuntu$ ssh localhost

Since this is the first time you're trying to connect using SSH, you'll have to answer yes to the following question:

The authenticity of host 'localhost (::1)' can't be established.

RSA key fingerprint is 18:4d:96:b3:0d:25:00:c8:a1:a3:84:5c:9f:1c:0d:a5.

Are you sure you want to continue connecting (yes/no)? yes

… you'll then be prompted for your own password (remember, the system treats such connection request as if you were connecting remotely, so it can't trust you without confirming your password):

Warning: Permanently added 'localhost' (RSA) to the list of known hosts.

greys@localhost's password:

.. and finally you'll see the usual Ubuntu (Jaunty in this example) banner and prompt:

Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686

The programs included with the Ubuntu system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by

applicable law.

To access official Ubuntu documentation, please visit:

http://help.ubuntu.com/

Last login: Fri May 15 15:18:34 2009 from ubuntu

ubuntu$

That's it, providing you have your networking configured and you know your IP address or hostname, you can start connecting to your Ubuntu box from remote systems, using the same command.  Enjoy!

然后本机是可以连接了!但是外部用putty还是不行!sudo ufw disable 关闭ufw防火墙,发现貌似根本没开!(也上网查了,自己不装,系统不会安装的!)
后来在http://forum.ubuntu.org.cn/viewtopic.php?t=40438,找到了这一行,貌似是系统的安全规则

iptables是内核模块删除不了滴

现查看一下你iptables的规则

sudo iptables -L

sudo iptables -t nat -L

如果都是空的就不是iptables的问题

如果有许多规则的话就清空规则并修改默认策略

sudo iptables -F

sudo iptables -t nat -F

sudo iptables -P ACCEPT

sudo iptables -t nat -P ACCEPT

按着弄了一遍!最后两条都出现问题了!忘记截图了!好像是说没有这个命令,请查阅help什么的!不管!弄完,我去别的电脑上用putty连接,出现证书验证,yes,进入了!输入用户名后,有点慢,修改sudo gedit /etc/ssh/sshd_config

找到 GSSAPI options 这一节,将下面两行注释掉:

#GSSAPIAuthentication yes

#GSSAPIDelegateCredentials no

然后重新启动 ssh 服务即可:

sudo /etc/init.d/ssh restart

摘自:http://blog.istef.info/2008/10/02/setup-ssh-server-on-ubuntu-server/

2011-08-23 12:58 上传

下载附件 (132.41 KB)

我的本来就是注释掉了阿!呵呵!不修改了!
以上是我安装ssh,解决的全过程!留着备用!

http://bbs.chinaunix.net/thread-3585704-1-1.html

ubuntu安装ssh无法连接解决日志(已解决,可连接)-转相关推荐

  1. Ubuntu安装ssh服务(避坑指南)

    Ubuntu安装ssh服务 前言 相关软件 操作步骤 后记 参考文章 前言 进行环境搭建时,想用Xshell连接虚拟机,但总提示" Connect fail-".查找了许多资料,才 ...

  2. 【Linux】ubuntu安装ssh服务端openssh-server

    [Linux]ubuntu安装ssh服务端openssh-server 1.背景 2.解决办法 3.测试 1.背景 ubuntu安装后默认只有ssh客户端,只能去连其它ssh服务器: 其它客户端想要连 ...

  3. ubuntu安装SSH的方法

    Ubuntu安装SSH的方法.14版的ubuntu经过测试,默认没有开启SSH,所以需要安装. 1.虚拟机设置网卡为桥接模式,即NAT.12版虚拟机默认的. 2.查看ubuntu使用的ip. ifco ...

  4. 虚拟机ubuntu安装ssh服务器,经过Xshell远程链接虚拟机VMVARE中的Ubuntu

    本文将讲解如何经过Xshell远程链接虚拟机中的Ubuntu,从而没必要主系统和虚拟机来回切换.php 1. 下载并安装Xshell 先下载并安装合适版本的Xshell rj.baidu.com/so ...

  5. ubuntu安装ssh服务器

    ubuntu安装ssh服务器 xshell连接远程ip失败,检查一下Ubuntu有没有安装SSH ubuntu查看ssh服务器,输入sudo service ssh status查看系统是否安装ssh ...

  6. Ubuntu虚拟机不显示ip地址【已解决】

    Ubuntu虚拟机不显示ip地址[已解决] 安装的Ubuntu虚拟机经常碰到不显示ip地址的情况 如下图: 无法显示ens33的ip地址 解决办法如下: 进入管理员账户,打开终端输入sudo /sbi ...

  7. Ubuntu安装deb软件包错误(依赖关系问题)解决

    Ubuntu安装deb软件包错误(依赖关系问题)解决 参考文章: (1)Ubuntu安装deb软件包错误(依赖关系问题)解决 (2)https://www.cnblogs.com/congyucn/p ...

  8. Ubuntu 安装 SSH 服务

    Ubuntu 安装 SSH 服务 1.安装 SSH 服务器,查看报错信息 sudo apt-get install openssh-server 2.根据报错显示的内容,需要安装对应的 openssh ...

  9. 电脑安装linux办公软件,Ubuntu安装WPS办公软件报错怎么解决

    Ubuntu64位系统在安装WPS办公软件的时候,有时会出现错误,而且报错代码一长串看不懂,让很多用户烦恼,这是怎样的错误呢?下面小编就给大家介绍下Ubuntu安装WPS办公软件报错的解决方法,一起来 ...

  10. ubuntu安装ssh

    ubuntu安装ssh 1 切换root用户,输入密码 2 安装服务程序 3 安装客户端程序 4 修改配置文件 5 设置windows下自启动 1 切换root用户,输入密码 2 安装服务程序 输入: ...

最新文章

  1. 适合平面设计的linux版本,Qogir - 色彩鲜艳的Linux平面设计图标主题
  2. 把office文档转换为html过程中的一些坑
  3. hadoop3.2.0集群搭建的一些坑!
  4. OS / Linux / Select 调用流程
  5. python重复输入上面指令_stdin stdout python:如何重复使用同一输入文...
  6. stack 和 heap区别
  7. 数据结构---AVL树调整方法(详)
  8. ul 中的li取值问题
  9. android 输入框失去焦点,AutoCompleteTextView默认首次失去焦点
  10. 【html】非配对的标签
  11. 跨站请求伪造(CSRF)攻击是什么?如何防御?
  12. 免费且快速搭建个人www服务器的教程
  13. css3实现3d正方体动画效果
  14. zigbee协议栈初使用(四)无线串口透传
  15. 李纳斯将注册 Linux 商标 用 Linux 名称将收费
  16. 【Python+Excel】批量操作Excel工作表和工作簿的5个实例
  17. Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included
  18. 51单片机+DS18B20+数码管显示+串口通讯+Proteus仿真
  19. 记一次js逆向详细过程
  20. chatbot 资料汇总

热门文章

  1. 深入推荐引擎相关算法 - 协同过滤
  2. java 类复制构造方法_java面向对象入门(3)-java构造方法
  3. System.out和System.err的区别
  4. windows下搭建SSH隧道内网映射
  5. SingToken全球首款区块链智能AI音乐钱包
  6. 【OGG】OGG简单配置双向复制(三)
  7. 学习微信小程序之css7
  8. Jersey +jetty 实现微服务(一)
  9. 经典算法面试题目-翻转一个C风格的字符串(1.2)
  10. a(n+1) = f[a(n)] 型递推数列的迭代作图(玩计算器玩出了问题)