从Jenkins Docker容器通过SSH进入远程主机

时间:2020-09-14 17:03:08

标签: docker

我正在运行docker容器,作为一项工作的一部分,我必须SSH到远程主机并在远程主机中执行一些命令。 我正在采用以下方法。

  1. 启动了Jenkins容器,并且运行良好
  2. 检查我是否能够ping通远程实例,并且工作正常。我也可以使用密码ssh。
  3. 现在我已经在docker容器中生成了公钥和私钥,并将公钥推送到远程主机的authorized_keys中。
  4. 当我尝试执行无密码SSH时,将使用密码方法。

下面是调试模式的输出-

explain analyse
select name, cosine_similarity_sql(vector, (select vector from image where id = 2852)) as sim
from image
order by sim desc;

Sort  (cost=8914.29..8967.30 rows=21204 width=26) (actual time=7692.156..7694.807 rows=20580 loops=1)
"  Sort Key: (cosine_similarity_sql((image.vector)::double precision[], ($0)::double precision[])) DESC"
  Sort Method: quicksort  Memory: 2376kB
  InitPlan 1 (returns $0)
    ->  Index Scan using image_pkey on image image_1  (cost=0.29..8.30 rows=1 width=18) (actual time=0.011..0.011 rows=1 loops=1)
          Index Cond: (id = 2852)
  ->  Seq Scan on image  (cost=0.00..7382.26 rows=21204 width=26) (actual time=0.635..7662.591 rows=20580 loops=1)
Planning Time: 0.242 ms
Execution Time: 7696.030 ms

不确定我缺少什么,因为我从码头工人主机到远程计算机执行无密码SSH时遵循完全相同的方法,

任何帮助表示感谢,非常感谢。

1 个答案:

答案 0 :(得分:0)

解决了问题。 为sshd启用日志记录,并在/ var / log / messages中发现了错误的主文件夹权限。

下面两个链接有助于解决-

https://www.howtogeek.com/168156/fixing-authentication-refused-bad-ownership-or-modes-for-directory/

https://security.stackexchange.com/questions/152594/understanding-the-offering-rsa-public-key-step-during-ssh-connection-initializ

相关问题