linux vm登录使用Shellscript

时间:2017-03-31 04:46:11

标签: linux bash ssh

我们有云虚拟机,我们可以通过WinSCP& amp ;;使用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).

1 个答案:

答案 0 :(得分:0)

问题是

Permissions 0664 for '/home/cloud-user/house_keeping/conf/ecp.pem' are too open.

ssh的手册页解释了应该在私钥上的权限:

  

这些文件包含敏感数据,应由用户读取,但其他人无法访问(读/写/执行)。

因此,您应该使用

将权限更改为0600
chmod 600 ~/ec2.pem