简体   繁体   English

将文件从我的本地 windows 电脑传输到我的 Linux 虚拟机

[英]Transferring files from my Local windows pc to my Linux VM

SO i am new to tech, and as previous posts suggests i am working with OCI.所以我是技术新手,正如之前的帖子所暗示的那样,我正在与 OCI 合作。 Currently i run a linux 8 VM on OCI.目前我在 OCI 上运行 linux 8 VM。 My goal is to run terraform scrips on the vm, and have the resources created in OCI.我的目标是在虚拟机上运行 terraform 脚本,并在 OCI 中创建资源。

Current problem: The tf files i will be writing will be done so on my local windows 10 machine.当前问题:我将要编写的 tf 文件将在我的本地 windows 10 机器上完成。 The files will be saved in a local directory.文件将保存在本地目录中。 I need a way of transferring these local files to a directory in my linux machine, in order to execute them!我需要一种将这些本地文件传输到我的 linux 机器中的目录的方法,以便执行它们!

Is anybody good with OCI is there capability for a sftp transfer using winscp??有人对 OCI 有好处吗?有没有使用 winscp 进行 sftp 传输的能力? I'm just not sure where to start.我只是不知道从哪里开始。 Anybody with good advice please aid me!任何有好的建议的人请帮助我!

It depends of your OCI network configuration.这取决于您的 OCI 网络配置。

If your OCI compute VM is in a public subnet and you have an internet gateway, then you can use ssh to connect to it (using putty for instance).如果您的 OCI 计算 VM 位于公共子网中并且您有 Internet 网关,则可以使用ssh连接到它(例如使用putty )。 That means you can also use scp which lets move copy files over ssh.这意味着您还可以使用scp将复制文件移动到 ssh 上。 As you mentioned, WinSCP let's you connect to your OCI compute VM by using ssh and scp or sFTP.正如您所提到的,WinSCP 让您使用 ssh 和 scp 或 sFTP 连接到您的 OCI 计算 VM。 After installing it you can create a new connection using the public ip of your OCI compute VM and the private key.安装后,您可以使用 OCI 计算 VM 的公共 ip 和私钥创建新连接。

My personal preference is to use MobaXterm to connect to ssh to my OCI compute VMs.我个人的偏好是使用MobaXterm将 ssh 连接到我的 OCI 计算 VM。 Once connected to a remote host using ssh, the left pane directly displays a file browser for the remote host.使用 ssh 连接到远程主机后,左侧窗格将直接显示远程主机的文件浏览器。 Drag-and-dropping a file there would initiate an sFTP transfer automatically.将文件拖放到那里会自动启动 sFTP 传输。

Please also note that scp is obsolete since 2019. SFTP or rsync could be used instead.另请注意, scp 自 2019 年以来已过时。可以使用 SFTP 或 rsync 代替。 Using MobaXterm, it can be done by opening a new terminal tab (which is local to your Windows machine) and type the rsync command you wish for instance rsync -v -P -e 'ssh -i "D:/my_folder/oci_api_key.pem"' /cygdrive/d/my_folder/*.tf opc@<oci_vm_ip>:/home/opc/my_folder使用 MobaXterm,可以通过打开一个新的终端选项卡(位于 Windows 机器的本地)并键入您希望的 rsync 命令来完成,例如rsync -v -P -e 'ssh -i "D:/my_folder/oci_api_key.pem"' /cygdrive/d/my_folder/*.tf opc@<oci_vm_ip>:/home/opc/my_folder

-v is increasing verbosity, to display more information. -v增加详细程度,以显示更多信息。 -P displays partial progress for each file transferred. -P显示每个传输文件的部分进度。 -e lets you specify which command to use to run rsync. -e让您指定使用哪个命令来运行 rsync。 in this case I use ssh and pass the private key.在这种情况下,我使用 ssh 并传递私钥。 More option are available and you can check them by typing man rsync .有更多选项可用,您可以通过键入来检查它们man rsync

If your OCI compute VM is in a private subnet , you would need to set up a bastion VM in a public subnet to first access the bastion and then the VM.如果您的 OCI 计算 VM 位于私有子网中,则需要在公共子网中设置堡垒 VM,以首先访问堡垒,然后访问 VM。 Here is a blog post about how to achieve that using putty and WinSCP: https://www.ateam-oracle.com/ssh-tunnel-to-a-private-vm-using-a-bastion-host-in-oci这是一篇关于如何使用 putty 和 WinSCP 实现这一目标的博客文章: https://www.ateam-oracle.com/ssh-tunnel-to-a-private-vm-using-a-bastion-host-in-oci

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

相关问题 从本地 windows PC 和 Linux 传输数据 - Transfer data from local windows PC and Linux 使用 rsync 从 Windows 传输到 Linux - Transferring from Windows to Linux with rsync 将NetBeans项目从Windows转移到Linux VM时,Ant生成错误 - Error with Ant build when transferring NetBeans project from Windows to Linux VM 我的Mac上正在运行本地MAMP服务器。 有没有办法从我的Linux机器访问其文件? - Local MAMP server is working on my Mac. Is there a way to access its files from my Linux machine? 使用smbget从Windows转移到Node JS中的Linux - Transferring from Windows to Linux in node js with smbget 使用PyWinRM将Powershell脚本从Linux传输到Windows - Transferring a powershell script with PyWinRM from Linux to Windows 使用命令行将文件从远程 Windows pc 获取到 linux pc - Getting files from remote windows pc into linux pc using command line 如何从 Google Cloud Console 将文件夹下载到我的本地 PC - How to download a folder to my local PC from Google Cloud console 在Linux和Windows之间使用pysftp.get_r传输文件 - transferring files with pysftp.get_r between linux and windows 是否可以将文件从本地 windows 目录复制到远程 linux 目录? - Is it possible to copy files from local windows directory to remote linux directory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM