无法将 python hello world 应用程序上传到 Ubuntu EC2

问题描述 投票:0回答:1

用户 我在笔记本电脑上的 VS Code 上创建了一个简单的 hello world 应用程序。我正在尝试在我在 AWS 上创建的 Ubuntu EC2 实例上运行它。一旦我 ssh 进入实例,我就会发出以下命令:

scp -i "C:/Users/ahmed/Downloads/python.pem" "D:/Python/hello.py" [email protected]:~/hello.py

并得到以下错误:

Warning: Identity file C:/Users/ahmed/Downloads/python.pem not accessible: No such file or directory. [email protected]: Permission denied (publickey). scp: Connection closed

私钥位于我的下载文件夹中,python 应用程序位于 D 盘中的 Python 文件夹中。是否有任何命令或任何其他方法可以将应用程序部署到 EC2 实例上?

python amazon-ec2 ssh server permissions
1个回答
0
投票

也许您的文件的权限太开放(在Linux机器中我们将私钥限制为0400)。您可以尝试在 Windows 计算机中限制它。还可以尝试使用 -v 开关通过 ssh 登录您的 EC2 计算机以查看警告。

在 Windows 资源管理器中找到该文件,右键单击它,然后选择“属性”。导航到“安全”选项卡并单击“高级”。将所有者更改为您,禁用继承并删除所有权限。然后授予自己“完全控制”并保存权限。以下 - https://superuser.com/questions/1296024/windows-ssh-permissions-for-private-key-are-too-open 我们很高兴知道它是否有效。

© www.soinside.com 2019 - 2024. All rights reserved.