简体   繁体   English

Termux 中的 Amazon Web Services EC2 ssh 权限被拒绝(公钥)

[英]Amazon Web Services EC2 ssh permission denied (publickey) in Termux

ssh -i key.pem ec2-user@dns works fine in my laptop running ubuntu. ssh -i key.pem ec2-user@dns在我运行 ubuntu 的笔记本电脑上运行良好。 I found out about Termux in android and I wanted to test if I could connect on using the same process and instance.我在 android 中发现了 Termux,我想测试我是否可以使用相同的进程和实例进行连接。 I opened Google Chrome in android and then created a new Key Pair and also added my IP on the security groups.我在 android 中打开了谷歌浏览器,然后创建了一个新的密钥对,并在安全组中添加了我的 IP。 After that I copied it in the home folder created in Termux and modified chmod 400 androidkey.pem .之后,我将其复制到在 Termux 中创建的主文件夹中并修改了chmod 400 androidkey.pem When I run ssh -i androidkey.pem ec2-user@dns in Termux, it gives me an error saying permission denied (publickey).当我在ssh -i androidkey.pem ec2-user@dns运行ssh -i androidkey.pem ec2-user@dns时,它给我一个错误,提示权限被拒绝(公钥)。 Is there a way to fix this?有没有办法解决这个问题?

I believe this has more to do with Termux and the particular way it does things.我相信这更多地与 Termux 以及它做事的特殊方式有关。 I am having the same problem with a different server entirely.我在完全不同的服务器上遇到了同样的问题。

I was able to login through the termux app into ssh client,I would recommend you to check these things我能够通过 termux 应用程序登录到 ssh 客户端,我建议您检查这些内容

  1. make sure the termux app has access to your file system if not run this command termux-setup-storage如果不运行此命令,请确保 termux 应用程序可以访问您的文件系统termux-setup-storage
  2. make sure you have the .pem file available in the current location by typing ls通过键入ls确保您在当前位置拥有 .pem 文件
  3. go to aws console and copy the string to connect to the instance and转到 aws 控制台并复制字符串以连接到实例,然后
    make sure you don't give quotes ("") around the .pem file确保不要在 .pem 文件周围加上引号 ("")

eg enter ssh -i instancefilename.pem yourinstancepublicdns@amazonaws.com例如输入ssh -i instancefilename.pem yourinstancepublicdns@amazonaws.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM