Skip to content

Commit 3d29d7d

Browse files
authored
Merge pull request #209456 from mattmcinnes/patch-10
Update copy-files-to-vm-using-scp.md
2 parents 9a1d2b4 + 5d465e9 commit 3d29d7d

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
title: Use SCP to move files to and from a VM
33
description: Securely move files to and from a Linux VM in Azure using SCP and an SSH key pair.
4-
author: cynthn
4+
author: mattmcinnes
55
ms.service: virtual-machines
66
ms.workload: infrastructure
77
ms.topic: how-to
8-
ms.date: 07/30/2022
9-
ms.author: cynthn
8+
ms.date: 12/9/2022
9+
ms.author: mattmcinnes
10+
ms.custom: GGAL-freshness822
1011
---
1112

1213
# Use SCP to move files to and from a VM
@@ -15,18 +16,18 @@ ms.author: cynthn
1516

1617
This article shows how to move files from your workstation up to an Azure VM, or from an Azure VM down to your workstation, using Secure Copy (SCP). Moving files between your workstation and a VM, quickly and securely, is critical for managing your Azure infrastructure.
1718

18-
For this article, you need a VM deployed in Azure with SSH enabled. You also need an SCP client for your local computer. It is built on top of SSH and included in the default shell of most computers.
19+
For this article, you need a VM deployed in Azure with SSH enabled. You also need an SCP client for your local computer. It's built on top of SSH and included in the default shell of most Linux and Windows (10 and newer) installations.
1920

2021

2122
## Quick commands
2223

23-
Copy a file up to the VM
24+
Upload a file to the VM
2425

2526
```bash
2627
scp file azureuser@azurehost:directory/targetfile
2728
```
2829

29-
Copy a file down from the VM
30+
Download a file from the VM
3031

3132
```bash
3233
scp azureuser@azurehost:directory/file targetfile
@@ -38,11 +39,11 @@ As examples, we move an Azure configuration file up to a VM and pull down a log
3839

3940
## SSH key pair authentication
4041

41-
SCP uses SSH for the transport layer. SSH handles the authentication on the destination host, and it moves the file in an encrypted tunnel provided by default with SSH. For SSH authentication, usernames and passwords can be used. However, SSH public and private key authentication are recommended as a security best practice. Once SSH has authenticated the connection, SCP then begins copying the file. Using a properly configured `~/.ssh/config` and SSH public and private keys, the SCP connection can be established by just using a server name (or IP address). If you only have one SSH key, SCP looks for it in the `~/.ssh/` directory, and uses it by default to log in to the VM.
42+
SCP uses SSH for the transport layer. SSH handles the authentication on the destination host, and it moves the file in an encrypted tunnel provided by default with SSH. For SSH authentication, usernames and passwords can be used. However, SSH public and private key authentication are recommended as a security best practice. Once SSH has authenticated the connection, SCP then begins copying the file. When you use a properly configured `~/.ssh/config` and SSH public and private keys, the SCP connection can be established by just using a server name (or IP address). If you only have one SSH key, SCP looks for it in the `~/.ssh/` directory, and uses it by default to log in to the VM.
4243

4344
For more information on configuring your `~/.ssh/config` and SSH public and private keys, see [Create SSH keys](./linux/mac-create-ssh-keys.md).
4445

45-
## SCP a file to a VM
46+
## Upload a file to a VM
4647

4748
For the first example, we copy an Azure configuration file up to a VM that is used to deploy automation. Because this file contains Azure API credentials, which include secrets, security is important. The encrypted tunnel provided by SSH protects the contents of the file.
4849

@@ -52,9 +53,9 @@ The following command copies the local *.azure/config* file to an Azure VM with
5253
scp ~/.azure/config [email protected]:/home/azureuser/config
5354
```
5455

55-
## SCP a directory from a VM
56+
## Download a directory from a VM
5657

57-
For this example, we copy a directory of log files from the VM down to your workstation. A log file may or may not contain sensitive or secret data. However, using SCP ensures the contents of the log files are encrypted. Using SCP to transfer the files is the easiest way to get the log directory and files down to your workstation while also being secure.
58+
For this example, we copy a directory of log files from the VM down to your workstation. A log file may or may not contain sensitive or secret data. However, using SCP ensures the contents of the log files are encrypted. A log directory may contain too many relevant files to copy one at a time, so downloading the whole directory is preferred in this situation. Using SCP to transfer the files is the easiest way to get the log directory and files down to your workstation while also being secure.
5859

5960
The following command copies files in the */home/azureuser/logs/* directory on the Azure VM to the local /tmp directory:
6061

@@ -66,4 +67,4 @@ The `-r` flag instructs SCP to recursively copy the files and directories from t
6667

6768
## Next steps
6869

69-
* [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](./extensions/vmaccess.md)
70+
* [Manage users, SSH, and check or repair disks on Azure Linux VMs using the 'VMAccess' Extension](/extensions/vmaccess.md)

0 commit comments

Comments
 (0)