AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[amazon-ec2](ubuntu)

Martin Hope
Uwe Keim
Asked: 2020-10-29 06:43:48 +0800 CST

如何通过 SSH 连接到无法访问的 EC2 实例?

  • 1

拥有一个运行Discourse数年的 AWS EC2 实例。

由于某些周/月会发生在某些 Discourse 升级后(通过 Discourse 的 Web GUI),系统会停止。然后不再可以通过 SSH 访问它,甚至无法通过 EC2 SSH Web 连接访问。

我通常通过 AWS ECS Web 管理面板重新启动整个机器,然后能够通过 SSH 和 HTTPS 再次连接。

(不幸的是,我没有进一步调查问题的原因)。

今天,Discourse 升级后系统再次挂起。

但这一次,没有重新启动或任何帮助。即使等待了几个小时,系统仍然无法通过 SSH 访问。

EC2 监控也显示我没有高服务器负载:

在此处输入图像描述

我的问题

如何再次通过 SSH 访问 EC2 Ubuntu 实例?

更新 1

又一次重新启动并等待一段时间后,系统又回来了,不知从何而来。

对我来说,磁盘似乎有足够的可用空间(没有更多的磁盘空间是我假设系统无法访问的原因之一)。

Filesystem      Size  Used Avail Use% Mounted on
udev            2.0G     0  2.0G   0% /dev
tmpfs           394M  876K  393M   1% /run
/dev/xvda1       97G   31G   67G  31% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/loop1       18M   18M     0 100% /snap/amazon-ssm-agent/1566
/dev/loop0       98M   98M     0 100% /snap/core/10185
/dev/loop2       29M   29M     0 100% /snap/amazon-ssm-agent/2012
/dev/loop3       98M   98M     0 100% /snap/core/10126
overlay          97G   31G   67G  31% /var/lib/docker/overlay2/5a799ab040002ad2ddec94ae85bcbe987543651a0d9478ddc12ab12715da7340/merged
tmpfs           394M     0  394M   0% /run/user/1000

我现在正试图弄清楚是否有任何日志表明中断的原因。

更新 2

根据 heynnema 的要求,以下是完整的结果sudo cat /etc/netplan/*.yaml:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
            dhcp4: true
            match:
                macaddress: 06:a0:68:ea:54:4e
            set-name: eth0
server ssh amazon-ec2 18.04
  • 1 个回答
  • 388 Views
Martin Hope
Ten Digit Grid
Asked: 2020-10-23 14:05:56 +0800 CST

AWS EC2 Ubuntu 16.04.7 LTS 升级问题

  • 3

我有一个运行网站的 AWS EC2 实例,在升级它时遇到了问题。

以下是我尝试过的步骤:

$ sudo apt update
$ sudo apt upgrade

在此处输入图像描述

在第一部分之后,一切看起来都很好,然后我继续:

sudo do-release-upgrade

然后我们出错了:

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 2072, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1981, in fullUpgrade
    if not self.askDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1153, in askDistUpgrade
    changes = self.calcDistUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1120, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeCache.py", line 856, in installTasks
    pkg.mark_install()
  File "/usr/lib/python3/dist-packages/apt/package.py", line 1356, in mark_install
    fixer.resolve(True)
SystemError: E:Unable to correct problems, you have held broken packages.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 497, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 450, in write
    block = f.read(1048576)
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Original exception was:
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 2072, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1981, in fullUpgrade
    if not self.askDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1153, in askDistUpgrade
    changes = self.calcDistUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1120, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeCache.py", line 856, in installTasks
    pkg.mark_install()
  File "/usr/lib/python3/dist-packages/apt/package.py", line 1356, in mark_install
    fixer.resolve(True)
SystemError: E:Unable to correct problems, you have held broken packages.
=== Command terminated with exit status 1 (Thu Oct 22 03:03:11 2020) ===

在查看了更多错误之后,我认为这是我的问题所在,但我仍然卡住了,不知道从这里做什么:

Reinst Failed because of python3-zope.interface:amd64  MarkKeep python3-twisted [ amd64 ]
upgrade aws amazon-ec2
  • 2 个回答
  • 1892 Views
Martin Hope
Anonymous shooter
Asked: 2020-08-13 11:12:36 +0800 CST

无法登录使用 AMI 创建的 amazion ec2

  • 0

我无法使用密码登录我的 aws ec2 实例

这里我解释一下我做了什么

  1. 创建新的 aws ec2 实例(删除密钥登录并启用密码登录)
  2. 创建图像
  3. 再次使用之前创建的 AMI 创建新实例

然后我尝试通过 ssh new create instances 登录,但我无法登录?(在新情况下)

aws amazon-ec2
  • 1 个回答
  • 130 Views
Martin Hope
DaveO
Asked: 2020-07-19 17:31:58 +0800 CST

apt-get 更新私有 IPv6 AWS EC2

  • 3

我在私有子网上有一个 EC2,带有一个 IPv6 仅出口网关。VPC、子网和 EC2 都支持 IPv6,并且为 EC2 分配了 IPv6 IP 地址。

我可以 ping 并运行 curl 以从互联网上下载内容。

但是,当我运行时apt-get update我超时:

root@ip-10-0-20-20:~# apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Err:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic InRelease  Could not connect to us-west-2.ec2.archive.ubuntu.com:80 (54.191.70.203), connection timed out

我假设这是因为它有一个私有 IPv4 地址(10.0.0.0/16)并试图用它来更新?我如何才能在 IPv6 下运行?为什么它不尝试通过 IPv6 地址连接 archive.ubuntu.com?

如果我尝试强制使用 IPv6 No address associated with hostname,这是否意味着 Ubuntu EC2 软件包不支持 IPv6??!!

root@ip-10-0-20-20:/var/snap/amazon-ssm-agent/1566# sudo apt-get -o Acquire::ForceIPv6=true update
Err:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic InRelease
  Something wicked happened resolving 'us-west-2.ec2.archive.ubuntu.com:http' (-5 - No address associated with hostname)
networking ipv6 apt amazon-ec2
  • 1 个回答
  • 796 Views
Martin Hope
Laxman Singh Rajpurohit
Asked: 2020-06-02 08:06:36 +0800 CST

ec2 ubuntu 服务器 18.04 上的 Cloud-init 相关错误

  • 0

我的 EC2 Ubuntu 18.04 服务器出现以下错误。如果有人知道原因和解决方案,请帮助我。

当我尝试时,Cloud-init status我得到status: error了结果。

下面显示的错误日志来自/var/log/cloud-init-output.log:

Cloud-init v. 19.4-33-gbb4131a2-0ubuntu1~18.04.1 running 'init-local' at Fri, 01 May 2020 13:12:14 +0000. Up 8.38 seconds.
2020-05-01 13:12:14,988 - util.py[WARNING]: failed stage init-local
failed run of stage init-local
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 323, in main_init
init.fetch(existing=existing)
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 352, in fetch
return self._get_data_source(existing=existing)
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 253, in _get_data_source
util.del_file(self.paths.instance_link)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1793, in del_file
raise e
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1790, in del_file
os.unlink(path)
IsADirectoryError: [Errno 21] Is a directory: '/var/lib/cloud/instance'
------------------------------------------------------------
Cloud-init v. 19.4-33-gbb4131a2-0ubuntu1~18.04.1 running 'init-local' at Fri, 01 May 2020 18:10:43 +0000. Up 8.08 seconds.
2020-05-01 18:10:43,999 - util.py[WARNING]: failed stage init-local
failed run of stage init-local
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 323, in main_init
init.fetch(existing=existing)
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 352, in fetch
return self._get_data_source(existing=existing)
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 253, in _get_data_source
util.del_file(self.paths.instance_link)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1793, in del_file
raise e
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1790, in del_file
os.unlink(path)
IsADirectoryError: [Errno 21] Is a directory: '/var/lib/cloud/instance'

目前,服务器正在运行。

ubuntu@host:~$ sudo cat /etc/netplan/*.yaml

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}

network:
    ethernets:
        eth0:
            dhcp4: true
            match:
                macaddress: 02:9e:ef:ad:39:1a
            set-name: eth0
    version: 2

ubuntu@host:~$ ls -lah /etc/netplan/
total 20K
drwxr-xr-x   2 root root 4.0K May 18 04:10 .
drwxr-xr-x 117 root root  12K Jun  2 06:32 ..
-rw-r--r--   1 root root  481 Jun  1 09:51 50-cloud-init.yaml

ubuntu@host:~$ sudo lshw -C network
  *-network                 
       description: Ethernet interface
       physical id: 1
       logical name: eth0
       serial: 02:9e:ef:ad:39:1a
       capabilities: ethernet physical
       configuration: broadcast=yes driver=vif ip=172.31.1.160 link=yes multicast=yes

=========我在其他服务器上做的解决方案如下所示============

ref. link = https://cloudinit.readthedocs.io/en/latest/topics/faq.html

$ sudo DI_LOG=stderr /usr/lib/cloud-init/ds-identify --force
$ sudo cloud-init clean --logs
$ sudo cloud-init init --local
$ sudo cloud-init init

@heynnema Below  the output of cat /etc/netplan/*.yaml

root@ip-172-31-1-135:/# cat /etc/netplan/*.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens5:
            dhcp4: true
            match:
                macaddress: 02:69:72:f4:1e:aa
            set-name: ens5
    version: 2
server python amazon-ec2
  • 1 个回答
  • 3108 Views
Martin Hope
Susan Zhang
Asked: 2020-05-18 14:38:33 +0800 CST

桥接 Amazon EC2 Netplan (20.04)

  • 1

我一直在尝试使用 netplan 在我的 EC2 实例(Ubuntu 20.04)上创建一个网桥,但我一直无法访问我的机器。目前正在尝试禁用 ENA,但不确定我是否只是遗漏了一些明显的东西。这似乎类似于这个问题。

我的“库存”配置如下:

network:
    ethernets:
        ens5:
            dhcp4: true
            dhcp6: false
            match:
                macaddress: **:**:**:**:**:**
            set-name: ens5
    version: 2

与ifconfig并ip a返回:

ubuntu@ip-172-31-45-47:~$ ifconfig
ens5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 172.31.45.47  netmask 255.255.240.0  broadcast 172.31.47.255
        inet6 fe80::860:82ff:fef8:c11c  prefixlen 64  scopeid 0x20<link>
        ether <same as macaddress>  txqueuelen 1000  (Ethernet)
        RX packets 48418  bytes 64806497 (64.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9470  bytes 989568 (989.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 360  bytes 32234 (32.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 360  bytes 32234 (32.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ubuntu@ip-172-31-45-47:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
    link/ether 0a:60:82:f8:c1:1c brd ff:ff:ff:ff:ff:ff
    inet 172.31.45.47/20 brd 172.31.47.255 scope global dynamic ens5
       valid_lft 3104sec preferred_lft 3104sec
    inet6 fe80::860:82ff:fef8:c11c/64 scope link
       valid_lft forever preferred_lft forever

我尝试通过添加br0和复制 macaddress 来进行桥接,就像他们在此处所做的那样,但之后无法重新连接到 EC2 实例。

我都试过了

network:
    ethernets:
        ens5:
            dhcp4: false
            dhcp6: false
            match:
                macaddress: **:**:**:**:**:**
            set-name: ens5
    version: 2
    bridges:
        br0:
            dhcp4: true
            macaddress: **:**:**:**:**:**
            interfaces: [ens5]

就像在 netplan.io/examples 中用于桥接和在AWS dhcp 服务器周围工作一样,并且还dhcp完全删除了这些线路,因为显然我不知道我在做什么。

非常感谢任何建议,因为我根本没有太多配置网络的经验。谢谢!

amazon-ec2 netplan
  • 1 个回答
  • 407 Views
Martin Hope
Ahmed
Asked: 2020-05-09 15:11:13 +0800 CST

EC2 添加的内存未反映在磁盘空间中

  • 0

我为我的 EC2 实例添加了一些额外的空间,并按照 AWS docs调整了文件系统的大小。

不知道出了什么问题,但是尝试时我的磁盘大小显示正确,df -h但已用空间错误,不确定为什么我新添加的磁盘空间显示为已占用。

ncdu正在显示正确的已用空间。

如何修复现有文件系统并为其添加空间? 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

partitioning amazon-ec2
  • 1 个回答
  • 111 Views
Martin Hope
RACHEL
Asked: 2020-04-14 05:34:57 +0800 CST

Crontab - Linux - EC2 - Python - 没有名为“pandas”的模块

  • 0

我正在尝试通过 EC2 上的 crontab 运行 Python 脚本(它是网络抓取)。但它不起作用。

这是我的任务:

SHELL = /bin/bash
PATH = /usr/local/sbin:/usr/local / bin: / sbin: / bin: / usr / sbin: / usr / bin
* * / 2 * * * / usr / bin / python /home/ec2-user/LATAM_v1.py

我收到来自系统的电子邮件,说未安装 pandas。

但它已安装。

我还直接在 shell 中运行脚本:

/home/ec2-user/LATAM_v1.py
/ usr / bin / python home / ec2-user / LATAM_v1.py

两种方法都奏效了。

如果它们正在运行,我已经检查了 cron 和守护程序的状态,它们是。

这是错误:

From [email protected]  Sun Apr 12 10:10:02 2020
Return-Path: <[email protected]>
Received: from ip-172-31-3-2.sa-east-1.compute.internal (localhost [127.0.0.1])
        by ip-172-31-3-2.sa-east-1.compute.internal (8.14.4/8.14.4) with ESMTP id 03CDA2Lb008039
        for <[email protected]>; Sun, 12 Apr 2020 10:10:02 -0300
Received: (from root@localhost)
        by ip-172-31-3-2.sa-east-1.compute.internal (8.14.4/8.14.4/Submit) id 03CDA2W8008038;
        Sun, 12 Apr 2020 10:10:02 -0300
Date: Sun, 12 Apr 2020 10:10:02 -0300
Message-Id: <202004121310.03CDA2W8008038@ip-172-31-3-2.sa-east-1.compute.internal>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <root@ip-172-31-3-2> /usr/bin/python /home/ec2-user/LATAM_v1.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

Traceback (most recent call last):
  File "/home/ec2-user/LATAM_v1.py", line 10, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

This is the version of the machine:
NAME = "Amazon Linux AMI"
VERSION = "2018.03"
ID = "amzn"
ID_LIKE = "rhel fedora"
PRETTY_NAME = "Amazon Linux AMI 2018.03"

我已经审查了 Stackoverflow,我得到了很多答案等等,但这里没有任何效果。

我对Linux不熟悉。如果有人知道如何解决它并逐步解释它,我将不胜感激。

非常感谢。

python cron amazon-ec2
  • 1 个回答
  • 1428 Views
Martin Hope
political science
Asked: 2020-03-04 02:12:24 +0800 CST

从虚拟机 ubuntu 19.10 SSH 到亚马逊 AWS 实例

  • 1

我有 aws 实例密钥 .pem 文件,我将其保存在文件夹中

"home/debian/cs605\ data\ management/assignment6/mumbai\ instance\ keys"

键名是 mumbai-instance-1.pem

我写了一个像这样的小 bash 脚本

!/bin/bash

AWS_KEY="home/debian/cs605\ data\ management/assignment6/mumbai\ instance\ keys"

ssh -v -i $AWS_KEY/mumbai-instance-1.pem
[email protected]

上面的文件保存在以下文件夹中,名为 mumbai

/home/debian/cs605 数据管理/assignment6

现在我尝试在之后启动脚本,chmox +x mumbai 但出现错误

Warning: Identity file home/debian/cs605\ not accessible: No such file or directory.
OpenSSH_8.0p1 Ubuntu-6build1, OpenSSL 1.1.1c  28 May 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
ssh: Could not resolve hostname data\\: Name or service not known
./mumbai: line 6: [email protected]: command not found

那么这个错误是什么,我该如何摆脱这个错误。

更新1
我尝试了答案中提到的方法

debian@osboxes:~/cs605 data management/assignment6$ ./mumbai
Warning: Identity file home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem not accessible: No such file or directory.
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command]
./mumbai: line 6: [email protected]: command not found

我检查了文件的权限

debian@osboxes:~/cs605 data management/assignment6/mumbai instance keys$ ls -l
total 8
-rwxr-xr-x 1 debian debian 1692 Mar  3 14:24 mumbai-instance-1.pem
-rwxrw-rw- 1 debian debian 1464 Mar  3 14:30 mumbai-instance-pvt.ppk

所以我认为这不应该是权限问题。

我在上面的 AWS_KEY 中犯了一个错误,应该是 /home

更新2

现在,在解决上述问题时,当我使用 AWS_KEY="/home/debian/cs605\ data\ management/assignment6/mumbai\ instance\ keys" 执行上述脚本时,我得到了关注

debian@osboxes:~/cs605 data management/assignment6$ ./mumbai
OpenSSH_8.0p1 Ubuntu-6build1, OpenSSL 1.1.1c  28 May 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-xx-xxx-xx-xxx.ap-south-1.compute.amazonaws.com [xx-xxx-xx-xxx] port 22.
debug1: Connection established.
debug1: identity file /home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem type -1
debug1: identity file /home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.0p1 Ubuntu-6build1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to ec2-xx-xxx-xx-xxx.ap-south-1.compute.amazonaws.com:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:q5biO+y+QovuhX7TUfVShKOh7nQ/TaVUPhs8YI8EJOs
The authenticity of host 'ec2-xx-xxx-xx-xxx.ap-south-1.compute.amazonaws.com (xx-xxx-xx-xxx)' can't be established.
ECDSA key fingerprint is SHA256:q5biO+y+QovuhX7TUfVShKOh7nQ/TaVUPhs8YI8EJOs.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ec2-xx-xxx-xx-xxx.ap-south-1.compute.amazonaws.com,xx-xxx-xx-xxx' (ECDSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: debian@osboxes RSA SHA256:iFf3gBtMBnZsrEYwqUEZBanwk9vj6/nf64NfpGerACU agent
debug1: Will attempt key: /home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem  explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1001)


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1001)


debug1: Next authentication method: publickey
debug1: Offering public key: debian@osboxes RSA SHA256:iFf3gBtMBnZsrEYwqUEZBanwk9vj6/nf64NfpGerACU agent
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: /home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/debian/cs605 data management/assignment6/mumbai instance keys/mumbai-instance-1.pem": bad permissions
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

好的,我修复了它,密钥文件应该有 700 权限,750 或 755 是不可接受的。

server ssh bash amazon-ec2
  • 1 个回答
  • 449 Views
Martin Hope
user1048281
Asked: 2020-02-27 17:18:14 +0800 CST

如何通过 ssh 将 Ansible 连接到 AWS-EC2

  • 2

我想通过 ssh 将 ansible 连接到 EC2。我在本地机器(ubuntu)上创建了一个密钥对,并使用 ssh-copy-id 将其复制到我的 EC2 实例中。复制成功,但是当我想连接到我的实例时出现以下错误:

Failed to connect to the host via ssh: [email protected]: Permission denied (publickey)

当我检查远程机器上的 auth.log 文件时,我看到以下日志:

invalid user usuario from 187.xx.xx.xx port 47988

这是我的 etc/ansible/hosts 文件

[host1]

github ansible_host=13.xxx.xxx.xx ansible_user=root

任何帮助将不胜感激。谢谢

server permissions ssh amazon-ec2 ansible
  • 2 个回答
  • 2988 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve