You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux-vm-connect.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ If you're having trouble connecting, you can also use portal:
61
61
Once the above prerequisites are met, you're ready to connect to your VM. Open your SSH client of choice. The SSH client command is typically included in Linux, macOS, and Windows. If you're using Windows 7 or older, where Win32 OpenSSH isn't included by default, consider installing [WSL](/windows/wsl/about) or using [Azure Cloud Shell](../cloud-shell/overview.md) from the browser.
62
62
63
63
> [!NOTE]
64
-
> The following examples assume the SSH key is in the key.pem format. If you used CLI or Azure PowerShell to download your keys, they may be in the id_rsa format.
64
+
> The following examples assume the SSH key is in the key.pem format. If you used CLI or Azure PowerShell to download your keys, they may be in the id_rsa or ED25519 format.
65
65
66
66
## [WSL, macOS, or native Linux client](#tab/Linux)
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux/create-ssh-keys-detailed.md
+89-3Lines changed: 89 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,12 @@ The following `ssh-keygen` command generates 4096-bit SSH RSA public and private
48
48
ssh-keygen -m PEM -t rsa -b 4096
49
49
```
50
50
51
+
The following `ssh-keygen` command generates 256-bit ED25519 public and private key files by default in the `~/.ssh` directory. If an existing SSH key pair is found in the current location, those files are overwritten.
52
+
53
+
```bash
54
+
ssh-keygen -m PEM -t ed25519
55
+
```
56
+
51
57
### Detailed example
52
58
The following example shows additional command options to create an SSH RSA key pair. If an SSH key pair exists in the current location, those files are overwritten.
53
59
@@ -57,10 +63,19 @@ ssh-keygen \
57
63
-t rsa \
58
64
-b 4096 \
59
65
-C "azureuser@myserver" \
60
-
-f ~/.ssh/mykeys/myprivatekey \
66
+
-f ~/.ssh/mykeys/myrsaprivatekey \
61
67
-N mypassphrase
62
68
```
69
+
The following example shows additional command options to create an SSH ED25519 key pair. If an SSH key pair exists in the current location, those files are overwritten.
63
70
71
+
```bash
72
+
ssh-keygen \
73
+
-m PEM \
74
+
-t ed25519 \
75
+
-C "azureuser@myserver" \
76
+
-f ~/.ssh/mykeys/myedprivatekey \
77
+
-N mypassphrase
78
+
```
64
79
**Command explained**
65
80
66
81
`ssh-keygen` = the program used to create the keys
@@ -77,7 +92,7 @@ ssh-keygen \
77
92
78
93
`-N mypassphrase` = an additional passphrase used to access the private key file.
`Enter file in which to save the key (/home/azureuser/.ssh/id_rsa): ~/.ssh/id_rsa`
109
149
110
-
The key pair name for this article. Having a key pair named `id_rsa` is the default; some tools might expect the `id_rsa` private key file name, so having one is a good idea. The directory `~/.ssh/` is the default location for SSH key pairs and the SSH config file. If not specified with a full path, `ssh-keygen` creates the keys in the current working directory, not the default `~/.ssh`.
150
+
or
151
+
152
+
`Enter file in which to save the key (/home/azureuser/.ssh/id_ed25519): ~/.ssh/id_ed25519`
153
+
154
+
155
+
The default key pair names for RSA and ED25519 are `id_rsa` and `id_ed25519` respectively; some tools might expect the `id_rsa` or `id_ed25519` private key file name, so having one is a good idea. The directory `~/.ssh/` is the default location for SSH key pairs and the SSH config file. If not specified with a full path, `ssh-keygen` creates the keys in the current working directory, not the default `~/.ssh`.
111
156
112
157
#### List of the `~/.ssh` directory
113
158
114
159
To view existing files in the `~/.ssh` directory, run the following command. If no files are found in the directory or the directory itself is missing, make sure that all previous commands were successfully run. You may require root access to modify files in this directory on certain Linux distributions.
115
160
161
+
RSA Key pair:
116
162
```bash
117
163
ls -al ~/.ssh
118
164
-rw------- 1 azureuser staff 1675 Aug 25 18:04 id_rsa
119
165
-rw-r--r-- 1 azureuser staff 410 Aug 25 18:04 id_rsa.pub
120
166
```
121
167
168
+
ED25519 Key pair:
169
+
```bash
170
+
ls -al ~/.ssh
171
+
-rw------- 1 azureuser staff 1675 Aug 25 18:04 id_ed25519
172
+
-rw-r--r-- 1 azureuser staff 410 Aug 25 18:04 id_ed25519.pub
173
+
```
174
+
122
175
#### Key passphrase
123
176
124
177
`Enter passphrase (empty for no passphrase):`
@@ -129,12 +182,16 @@ It is *strongly* recommended to add a passphrase to your private key. Without a
129
182
130
183
If you use the [Azure CLI](/cli/azure) to create your VM, you can optionally generate both public and private SSH key files by running the [az vm create](/cli/azure/vm) command with the `--generate-ssh-keys` option. The keys are stored in the ~/.ssh directory. Note that this command option does not overwrite keys if they already exist in that location, such as with some pre-configured Compute Gallery images.
131
184
185
+
> [!NOTE]
186
+
> [az sshkey create](/cli/azure/sshkey#az-sshkey-create) command deafults to RSA encryption and cannot be use to generate ED25519 key pairs, however you can create a ED25519 key pair using ssh-keygen as described above and then use that public key to create a VM.
187
+
132
188
## Provide SSH public key when deploying a VM
133
189
134
190
To create a Linux VM that uses SSH keys for authentication, provide your SSH public key when creating the VM using the Azure portal, CLI, Resource Manager templates, or other methods. When using the portal, you enter the public key itself. If you use the [Azure CLI](/cli/azure) to create your VM with an existing public key, specify the value or location of this public key by running the [az vm create](/cli/azure/vm) command with the `--ssh-key-value` option.
135
191
136
192
If you're not familiar with the format of an SSH public key, you can see your public key by running `cat` as follows, replacing `~/.ssh/id_rsa.pub` with your own public key file location:
137
193
194
+
# RSA key pair
138
195
```bash
139
196
cat ~/.ssh/id_rsa.pub
140
197
```
@@ -158,6 +215,30 @@ ssh-keygen \
158
215
-m RFC4716 >~/.ssh/id_ssh2.pem
159
216
```
160
217
218
+
# ED25519 key pair
219
+
```bash
220
+
cat ~/.ssh/id_ed25519.pub
221
+
```
222
+
223
+
Output is similar to the following (redacted example below):
If you copy and paste the contents of the public key file into the Azure portal or a Resource Manager template, make sure you don't copy any additional whitespace or introduce additional line breaks. For example, if you use macOS, you can pipe the public key file (by default, `~/.ssh/id_ed25519.pub`) to **pbcopy** to copy the contents (there are other Linux programs that do the same thing, such as `xclip`).
230
+
231
+
If you prefer to use a public key that is in a multiline format, you can generate an RFC4716 formatted key in a 'pem' container from the public key you previously created.
232
+
233
+
To create a PEM formatted key from an existing SSH public key:
234
+
235
+
```bash
236
+
ssh-keygen \
237
+
-f ~/.ssh/id_ed25519.pub \
238
+
-e \
239
+
-m RFC4716 >~/.ssh/id_edssh.pem
240
+
```
241
+
161
242
## SSH to your VM with an SSH client
162
243
With the public key deployed on your Azure VM, and the private key on your local system, SSH to your VM using the IP address or DNS name of your VM. Replace *azureuser* and *myvm.westus.cloudapp.azure.com* in the following command with the administrator user name and the fully qualified domain name (or IP address):
163
244
@@ -184,6 +265,11 @@ Now add the private key to `ssh-agent` using the command `ssh-add`.
184
265
```bash
185
266
ssh-add ~/.ssh/id_rsa
186
267
```
268
+
or
269
+
270
+
```bash
271
+
ssh-add ~/.ssh/id_ed25519
272
+
```
187
273
188
274
The private key passphrase is now stored in `ssh-agent`.
@@ -47,6 +53,9 @@ If you use the [Azure CLI](/cli/azure) to create your VM with the [az vm create]
47
53
az vm create --name VMname --resource-group RGname --image Ubuntu2204 --generate-ssh-keys
48
54
```
49
55
56
+
> [!NOTE]
57
+
> [az sshkey create](/cli/azure/sshkey#az-sshkey-create) command deafults to RSA encryption and cannot be use to generate ED25519 key pairs, however you can create a ED25519 key pair using ssh-keygen as described above and then use that public key to create a VM.
58
+
50
59
## Provide an SSH public key when deploying a VM
51
60
52
61
To create a Linux VM that uses SSH keys for authentication, specify your SSH public key when creating the VM using the Azure portal, Azure CLI, Azure Resource Manager templates, or other methods:
@@ -57,19 +66,28 @@ To create a Linux VM that uses SSH keys for authentication, specify your SSH pub
57
66
58
67
If you're not familiar with the format of an SSH public key, you can display your public key with the following `cat` command, replacing `~/.ssh/id_rsa.pub` with the path and filename of your own public key file if needed:
59
68
69
+
# RSA key pair
60
70
```bash
61
71
cat ~/.ssh/id_rsa.pub
62
72
```
63
-
64
-
A typical public key value looks like this example:
73
+
A typical RSA public key value looks like this example:
If you copy and paste the contents of the public key file to use in the Azure portal or a Resource Manager template, make sure you don't copy any trailing whitespace. To copy a public key in macOS, you can pipe the public key file to `pbcopy`. Similarly in Linux, you can pipe the public key file to programs such as `xclip`.
71
89
72
-
The public key that you place on your Linux VM in Azure is by default stored in ~/.ssh/id_rsa.pub, unless you specified a different location when you created the key pair. To use the [Azure CLI 2.0](/cli/azure) to create your VM with an existing public key, specify the value and optionally the location of this public key using the [az vm create](/cli/azure/vm#az-vm-create) command with the `--ssh-key-values` option. In the following command, replace *myVM*, *myResourceGroup*, *UbuntuLTS*, *azureuser*, and *mysshkey.pub* with your own values:
90
+
The public key that you place on your Linux VM in Azure is by default stored under ``~/.ssh/`` directory, unless you specified a different location when you created the key pair. To use the [Azure CLI 2.0](/cli/azure) to create your VM with an existing public key, specify the value and optionally the location of this public key using the [az vm create](/cli/azure/vm#az-vm-create) command with the `--ssh-key-values` option. In the following command, replace *myVM*, *myResourceGroup*, *UbuntuLTS*, *azureuser*, and *mysshkey.pub* with your own values:
> During preview, Ed25519 keys can only be used with Linux VMs, we intend to extend the ED25519 support to Windows VMs soon.
43
+
41
44
## SSH clients
42
45
43
46
Recent versions of Windows 10 include [OpenSSH client commands](https://blogs.msdn.microsoft.com/commandline/2018/03/07/windows10v1803/) to create and use SSH keys and make SSH connections from PowerShell or a command prompt.
@@ -52,7 +55,7 @@ The easiest way to create and manage your SSH keys is to [use the portal to crea
52
55
53
56
You can also create key pairs with the [Azure CLI](/cli/azure) with the [az sshkey create](/cli/azure/sshkey#az-sshkey-create) command, as described in [Generate and store SSH keys](../ssh-keys-azure-cli.md).
54
57
55
-
To create an SSH key pair on your local computer using the `ssh-keygen` command from PowerShell or a command prompt, type the following command:
58
+
To create an SSH key pair on your local computer using the `ssh-keygen` command from PowerShell or a command prompt, use the following command:
Copy file name to clipboardExpand all lines: articles/virtual-machines/ssh-keys-portal.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ For more detailed information about creating and using SSH keys with Linux VMs,
33
33
34
34
1. On the **SSH Key** page, select **Create**.
35
35
36
-
:::image type="content" source="./media/ssh-keys/portal-sshkey.png" alt-text="Create a new resource group and generate an SSH key pair":::
36
+
:::image type="content" source="./media/ssh-keys/portal_ed25519_key.png" alt-text="Create a new resource group and generate an SSH key pair":::
37
37
38
38
1. In **Resource group** select **Create new** to create a new resource group to store your keys. Type a name for your resource group and select **OK**.
39
39
@@ -43,6 +43,8 @@ For more detailed information about creating and using SSH keys with Linux VMs,
43
43
44
44
1. In **SSH public key source**, select **Generate public key source**.
45
45
46
+
1. In **SSH Key Type**, select either **RSA SSH Format** or **Ed25519 SSH Format**[Preview]
Copy file name to clipboardExpand all lines: includes/virtual-machines-common-ssh-support.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,4 +12,4 @@ ms.author: jushiman
12
12
13
13
## Supported SSH key formats
14
14
15
-
Azure currently supports SSH protocol 2 (SSH-2) RSA public-private key pairs with a minimum length of 2048 bits. Other key formats such as ED25519 and ECDSA are not supported.
15
+
Azure currently supports SSH protocol 2 (SSH-2) RSA public-private key pairs with a minimum length of 2048 bits. Support for ED25519 Keys is in preview, other key formats such as ECDH and ECDSA are currenlty not supported.
0 commit comments