我们有云虚拟机,我们可以通过 WinSCP 和 Putty 使用 pem 和 ppk 文件登录。我打算编写一个 shell 脚本程序来登录这些机器。我尝试了类似的方法但没有成功。
ssh -i ~/ec2.pem ubuntu@12.34.56.78
Permissions 0664 for '/home/cloud-user/house_keeping/conf/ecp.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/cloud-user/house_keeping/conf/ecp.pem`enter code here`
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
最佳答案
问题是
Permissions 0664 for '/home/cloud-user/house_keeping/conf/ecp.pem' are too open.
ssh
的手册页解释了私钥上的权限:
These files contain sensitive data and should be readable by the user but not accessible by others (read/write/execute).
所以你应该使用 0600 更改权限
chmod 600 ~/ec2.pem
关于linux vm 登录使用 Shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43132641/