Skip to content

Commit 63a8685

Browse files
author
Mauricio
authored
Refactor SSH connection troubleshooting instructions
Updated commands and descriptions for resetting SSH keys and credentials. Removed redundant sections and clarified usage of az vm user update. Removed obsolete command.
1 parent 1c0d2c0 commit 63a8685

1 file changed

Lines changed: 5 additions & 32 deletions

File tree

support/azure/virtual-machines/linux/troubleshoot-ssh-connection.md

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ az vm user update --resource-group myResourceGroup --name myVM \
183183
--username myUsername --password myPassword
184184
```
185185

186-
If using SSH key authentication, you can reset the SSH key for a given user. The following example uses **az vm access set-linux-user** to update the SSH key stored in `~/.ssh/id_rsa.pub` for the user named `myUsername`, on the VM named `myVM` in `myResourceGroup`. Use your own values as follows:
186+
If using SSH key authentication, you can reset the SSH key for a given user. The following example uses **az vm user update** to update the SSH key stored in `~/.ssh/id_rsa.pub` for the user named `myUsername`, on the VM named `myVM` in `myResourceGroup`. Use your own values as follows:
187187

188188
```azurecli
189189
az vm user update --resource-group myResourceGroup --name myVM \
190-
--username myUsername --ssh-key-value ~/.ssh/id_rsa.pub
190+
--username myUsername --ssh-key-value "$(cat ~/.ssh/id_rsa.pub)"
191191
```
192192

193193
## Use the VMAccess extension
@@ -200,7 +200,7 @@ Create a file named `settings.json` with the following content:
200200

201201
```json
202202
{
203-
"reset_ssh":True
203+
"reset_ssh": true
204204
}
205205
```
206206

@@ -211,9 +211,9 @@ az vm extension set --resource-group philmea --vm-name Ubuntu \
211211
--name VMAccessForLinux --publisher Microsoft.OSTCExtensions --version 1.2 --settings settings.json
212212
```
213213

214-
### Reset SSH credentials for a user
214+
### Reset SSH credentials for a user.
215215

216-
If SSHD appears to function correctly, you can reset the credentials for a giver user. To reset the password for a user, create a file named `settings.json`. The following example resets the credentials for `myUsername` to the value specified in `myPassword`. Enter the following lines into your `settings.json` file, using your own values:
216+
If SSHD appears to function correctly, you can reset the credentials for a given user. To reset the password for a user, create a file named `settings.json`. The following example resets the credentials for `myUsername` to the value specified in `myPassword`. Enter the following lines into your `settings.json` file, using your own values:
217217

218218
```json
219219
{
@@ -236,33 +236,6 @@ az vm extension set --resource-group philmea --vm-name Ubuntu \
236236
--name VMAccessForLinux --publisher Microsoft.OSTCExtensions --version 1.2 --settings settings.json
237237
```
238238

239-
### Reset SSH configuration
240-
241-
The SSHD configuration itself may be misconfigured or the service encountered an error. You can reset SSHD to make sure the SSH configuration itself is valid. Resetting SSHD should be the first troubleshooting step you take.
242-
243-
The following example resets SSHD on a VM named `myVM` in the resource group named `myResourceGroup`. Use your own VM and resource group names as follows:
244-
245-
```azurecli
246-
azure vm reset-access --resource-group myResourceGroup --name myVM \
247-
--reset-ssh
248-
```
249-
250-
### Reset SSH credentials for a user
251-
252-
If SSHD appears to function correctly, you can reset the password for a giver user. The following example resets the credentials for `myUsername` to the value specified in `myPassword`, on the VM named `myVM` in `myResourceGroup`. Use your own values as follows:
253-
254-
```azurecli
255-
azure vm reset-access --resource-group myResourceGroup --name myVM \
256-
--user-name myUsername --password myPassword
257-
```
258-
259-
If using SSH key authentication, you can reset the SSH key for a given user. The following example updates the SSH key stored in `~/.ssh/id_rsa.pub` for the user named `myUsername`, on the VM named `myVM` in `myResourceGroup`. Use your own values as follows:
260-
261-
```azurecli
262-
azure vm reset-access --resource-group myResourceGroup --name myVM \
263-
--user-name myUsername --ssh-key-file ~/.ssh/id_rsa.pub
264-
```
265-
266239
## Restart a VM
267240

268241
If you have reset the SSH configuration and user credentials, or encountered an error in doing so, you can try restarting the VM to address underlying compute issues.

0 commit comments

Comments
 (0)