docker run -i -t qcdatainc/centos-jdk
yum update

yum install openssh-server

ssh -vvv -p 222 jenkins@172.17.0.17 //investigate ssh problems.

解决问题的思路:
1、先看看ssh服务是否启动。(service sshd status)
2、检查iptables防火墙是否拦截。(iptables -L)
3、检查/etc/hosts.allow,/etc/hosts.deny配置文件

SSH 客户端登陆以后自动退出

用-v 调试 部分日志:

ssh -v root@127.0.0.1 -p 23

23端口映射docker的一个centos容器

debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
root@127.0.0.1's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = zh_CN.UTF-8
Last login: Mon Jun 23 12:52:01 2014 from 172.17.42.1
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 127.0.0.1 closed.
Transferred: sent 1912, received 2128 bytes, in 0.0 seconds
Bytes per second: sent 55065.8, received 61286.6
debug1: Exit status 254
此问题 解决方案:

/etc/ssh/sshd_config 中的UsePAM yes 改成no

即可登录。

或者在docker file中加入

RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config

如果添加指纹的时候提示添加失败,是因为你以前添加过了这个ip的指纹。

   解决办法:将.ssh目录的known_hosts文件删除掉(好粗暴啊( ⊙ o ⊙ )啊!),也可以打开这个文件把对于ip的那条记录删除(这个就精细多了O(∩_∩)O哈哈~)

  如果操作步骤都正确,但是依然要求输入密码。一般是因为权限的问题。命令如下

chmod 644 ~/.ssh/authorized_keys

今天在服务器上执行远程操作命令出现以下的问题:
[root@www ~]# ssh 205.209.161.**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
6c:74:2a:d5:ae:2b:76:51:*:*.

解决方法:
在正在操作的机器上执行
vi ~/.ssh/known_hosts
 

进入此目录,删除的205.209.161.**相关rsa的信息即可.

或者删除这个文件
cd ~/.ssh/
rm known_hosts

docker and ssh issues的更多相关文章

  1. docker使用ssh远程连接容器(没钱买服务器又不想安装虚拟机患者必备)

    突然有需求,需要使用go语言写个ssh终端连接功能,这时候手上又没有服务器,虚拟机也没有,正好使用docker搞起来 docker容器开启sshd服务,模拟服务器 我们知道docker是可以用exec ...

  2. Ubuntu下面的docker开启ssh服务

    选择主流的openssh-server作为服务端: root@161f67ccad50:/# apt-get install openssh-server -y Reading package lis ...

  3. Docker构建ssh镜像

    FROM ubuntu MAINTAINER ggzone xxx@live.com ENV REFRESHED_AT 2015-10-21 RUN apt-get -qqy update & ...

  4. 解决 Docker Hadoop ssh "Connection to * closed".问题

    Docker 最近很火, 可以快速轻量级地虚拟出多个node,所以打算在Docker中跑Hadoop伪分布式应用. 其实要做出个简单的版本倒是不难,主要在 建立ssh无密码登录本机时,出现刚登录上去, ...

  5. Docker开启ssh服务

    一.准备 apt-get update       更新环境 apt-get install vim      安装vim vim  /etc/apt/source.list     更换软件源, 我 ...

  6. Mac git pull失败,最新操作系统导致 SSH issues with Mac OS X High Sierra

    Mac 升级到最新操作系统ssh加密方式和gitlub不一样,导致不能git pull  如:mac是md5加密方式,gitlut是aes-256-cbc加密方式 解决方法如下 A coworker ...

  7. docker - 容器里安装ssh

    docker安装ssh 通过命令行安装 pull ubuntu镜像 docker pull ubuntu:latest 启动并进入bash docker run -it -d ubuntu:laste ...

  8. SSH远程登陆docker容器

    环境: Ubuntu 16.04(mac osx的VMware Fushion环境) 任务: Ubuntu 16.04通过SSH登陆docker(目的是为了运行在其他服务器的Jenkins访问dock ...

  9. Docker实践(1)—入门

    tutorial centos6.5环境. # yum install docker-io -y 会依赖安装libcgroup,lxc,lxc-libs 启动docker # service dock ...

随机推荐

  1. 【代码审计】QYKCMS_v4.3.2 任意文件读取漏洞分析

      0x00 环境准备 QYKCMS官网:http://www.qykcms.com/ 网站源码版本:QYKCMS_v4.3.2(企业站主题) 程序源码下载:http://bbs.qingyunke. ...

  2. JSONP 劫持漏洞实例

    0x01 Jsonp简介 Jsonp(JSON with Padding) 是 json 的一种"使用模式",可以让网页从别的域名(网站)那获取资料,即跨域读取数据. 为什么我们从 ...

  3. linux环境下执行RF测试脚本

    1. 测试执行 测试管理平台需根据用户选中的测试案例,按照相应格式对执行启动命令进行组装和发送,触动案例的自动化测试执行. 命令格式根据测试模式(以项目为单位.以测试集为单位.以案例为单位)具有不同的 ...

  4. 全屏加载loading显示的解决方法

    step1:可以在网页里加一个div用来现实loading. <div id="loading"> <!--这里放你的loading时显示的动画或者文字--> ...

  5. The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make s

    我出现这个问题是引用资源文件问题 helper.getView(R.id.in_pic).setBackgroundResource(item.getResourceId()); //错的helper ...

  6. 【2014年12月6日】HR交流会

    今天的交流会感觉还是不错,体会到了一些东西,把它记下来. 想到什么写什么,可能没什么条理. 1.先选行业,再选职业,再选公司 根据自己的兴趣以及个人特长,能力等方面,需要定一个大概的方向,然后根据方向 ...

  7. 【规范】alibaba编码规范阅读

    一.编程规范 (一)命名规范 1.代码中的命名均不能以下划线或美元符号开始,也不能以下划线或美元符号结束 2.代码中的命名严禁使用评语与英文混合的方式,更不允许直接使用中文的方式 3.类名使用Uppe ...

  8. javah生成jni头文件时报错 Error: cannot access android.support...

    javah生成jni头文件时报错: Error: cannot access android.support.v7.app.AppCompatActivity class file for andro ...

  9. java(3) 面向对象

    1.super关键字 * 使用super关键字调用父类的成员变量和成员方法.具体格式: super.成员变量 super.成员方法([参数1,参数2...]) * 使用super关键字调用父类的构造方 ...

  10. [Offer收割]编程练习赛15 B.分数调查[加权并查集]

    #1515 : 分数调查 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi的学校总共有N名学生,编号1-N.学校刚刚进行了一场全校的古诗文水平测验. 学校没有公布测 ...