许可拒绝失去连接
我已经在Azure中创建了一个简单的VM,其中我必须托管一个用C的非常简单的服务器。
要将包含服务器的计算机上的文件夹发送到虚拟机上,我使用PowerShell的命令
scp -r <path_to_key.pem> <path_to_folder_on_my_pc> <azureuser@ip:/home/azureuser/>
:命令是否
azureuser@ip: Permission denied (publickey).
lost connection
有这个问题的人有解决方案吗?
I have created a simple VM in azure in which I will have to host a very simple server written in C.
To send the folder hosted on my computer containing the server to the virtual machine, I use the command from powershell:
scp -r <path_to_key.pem> <path_to_folder_on_my_pc> <azureuser@ip:/home/azureuser/>
The result of this command is
azureuser@ip: Permission denied (publickey).
lost connection
Would anyone who has had this problem have a solution ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将私钥复制到要传输文件的主机上的〜/ .ssh/ Directory。完成此操作后,您可以使用以下命令:
例如,您要使用名为key.pem的私有密钥将file.txt传输到azure vm(ip of 10.10.10.10)
。对于本地主机,您将文件的顺序转换为获取和用户@azureip。
You need to copy your private key to the ~/.ssh/ directory on the host from which you want to transfer the file. Once you have done that, you can use the following command:
So for example you want to transfer file.txt to your Azure VM (IP of 10.10.10.10) with the private key named key.pem
To pull a file from your Azure VM to your local host, you reverse the order of the file to get and user@azureip.
此问题可能会在您的公钥中引起。当您使用公共密钥创建Azure虚拟机时,请确保您的主目录中也存在公共密钥。这意味着当地工作站接受的权限,您可以使用公共密钥在本地计算机和虚拟机上保存下来,您可以使用公共密钥在Azure Virtual Machine中使用SSH。
参考: linux-到Azure的VM- by ale93p
假设如果要在SCP中使用私钥,则必须使用以下命令将文件从本地系统复制到Azure VM,
请确保Azure vm的in of in> nsg规则已打开端口22 ,并且默认情况下,VM的页面可通过<到达< em> 端口80/443 在公共IP地址上。
有关更多信息详细信息,请 参考 此链接:
使用ssh连接到Linux VM的密钥-Azure Virtual Machines | Microsoft Docs
使用SCP移动往返VM-Azure Virtual的文件机器|微软文档
This problem may cause in your public key. please Ensure that the public key is also present in your home directory when you create the Azure Virtual machine with a public key. Meaning The public key was kept on your both local computer and virtual machine Then, with the permission accept from your local workstation, you can use ssh into your Azure Virtual Machine using the public key.
Reference: linux - Can't scp to Azure's VM - by ale93p
Suppose if you want to use the private key in the SCP then you will have to use the below command to copy files from the local system to the Azure VM
Make sure that the Azure VM's incoming NSG rule has port 22 opened and by default VM'S page is reachable through port 80/443 over public IP address.
For more information in detail, please refer this link:
Use SSH keys to connect to Linux VMs - Azure Virtual Machines | Microsoft Docs
Use SCP to move files to and from a VM - Azure Virtual Machines | Microsoft Docs