SCP许可被拒绝(公钥)。仅在EC2上使用目录-r标志时 [英] SCP Permission denied (publickey). on EC2 only when using -r flag on directories

查看:158
本文介绍了SCP许可被拒绝(公钥)。仅在EC2上使用目录-r标志时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

scp -r /Applications/XAMPP/htdocs/keypairfile.pem上传ec2-user @ publicdns:/ var / www / html

其中上载为目录,返回权限被拒绝(公钥)。

where uploads is a directory returns Permission denied (publickey).

但是

scp -i /Applications/XAMPP/htdocs/keypairfile.pem footer.php ec2-user @ publicdns:/ var / www / html

有效(请注意标志更改)。

上传的文件为空文件夹

这些是上载目录的文件权限

These are the file permissions for the uploads directory

drwxrwxrwx 3 geoffreysangston管理员102 Nov 15 01:40上传

这些是/ var / www / html

These are the file permissions for /var/www/html

drwxr-x ---的文件权限-2 ec2-user ec2-user 4096 Jan 5 20 :45 html

我尝试将html更改为777,但这也不起作用。

I've tried changing html to 777 and that doesn't work either.

推荐答案

-i 标志指定要使用的私钥(.pem文件)。如果未指定该标志(如第一个命令中所示),它将使用默认的ssh密钥(通常在〜/ .ssh / 下)。

The -i flag specifies the private key (.pem file) to use. If you don't specify that flag (as in your first command) it will use your default ssh key (usually under ~/.ssh/).

因此,在第一个命令中,您实际上是在要求 scp 使用默认的ssh密钥上载.pem文件。我想这不是您想要的。

So in your first command, you are actually asking scp to upload the .pem file itself using your default ssh key. I don't think that is what you want.

尝试使用:

scp -r -i /Applications/XAMPP/htdocs/keypairfile.pem uploads/* ec2-user@publicdns:/var/www/html/uploads

这篇关于SCP许可被拒绝(公钥)。仅在EC2上使用目录-r标志时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆