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: support/azure/virtual-machines/linux/linux-vm-sshconnectionissue-perms.md
+12-14Lines changed: 12 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
title: SSH connection to Azure Linux VM fails due to permission and ownership issues
3
3
description: Resolves an issue in which the SSH service fails because the /var/empty/sshd, /var/lib/empty, or /var/run/sshd directory doesn't exist, or it isn't owned by the root user, or it's group-writable or world-writable.
4
-
ms.date: 04/15/2024
5
-
author: saimsh-msft
6
-
ms.reviewer: divargas, adelgadohell
4
+
ms.date: 03/13/2025
5
+
author: pagienge
6
+
ms.reviewer: divargas, adelgadohell, saimsh
7
7
ms.service: azure-virtual-machines
8
8
ms.custom: sap:Cannot connect to my VM, linux-related-content
9
9
ms.collection: linux
@@ -13,15 +13,13 @@ ms.collection: linux
13
13
14
14
**Applies to:**:heavy_check_mark: Linux VMs
15
15
16
-
[!INCLUDE [CentOS End Of Life](../../../includes/centos-end-of-life-note.md)]
17
-
18
16
This article provides solutions to an issue in which connecting to a Linux virtual machine (VM) via Secure Shell (SSH) fails because the _/var/empty/sshd_ directory in RHEL, the _/var/lib/empty_ directory in SUSE, or the _/var/run/sshd_ directory in Ubuntu, doesn't exist, or it isn't owned by the root user, or it's group-writable or world-writable.
19
17
20
18
## Symptoms
21
19
22
20
When you connect to a Linux virtual machine (VM) via SSH, the connection fails. You may receive the following error message about the affected directory, depending on your Linux distribution.
23
21
24
-
### [RHEL/CentOS](#tab/rhelsymp)
22
+
### [RHEL](#tab/rhelsymp)
25
23
26
24
```bash
27
25
sudo tail /var/log/messages
@@ -75,7 +73,7 @@ Here are two methods to repair the VM offline:
75
73
2. Sign in to the VM by using a local administrative account and its corresponding credential or password.
76
74
3. Run the following commands to resolve the permission and ownership issue:
77
75
78
-
### [RHEL/CentOS](#tab/rhelts1)
76
+
### [RHEL](#tab/rhelts1)
79
77
80
78
```bash
81
79
sudo mkdir -p /var/empty/sshd
@@ -111,7 +109,7 @@ In the Azure portal, open the **Properties** window of the VM to check the agent
111
109
1. Go to the Azure portal, locate your VM settings, and then select **Run Command** under **Operations**.
112
110
2. Execute the following shell script by selecting **RunShellScript** > **Run**:
113
111
114
-
### [RHEL/CentOS](#tab/rhelts2)
112
+
### [RHEL](#tab/rhelts2)
115
113
116
114
```bash
117
115
#!/bin/bash
@@ -155,12 +153,12 @@ If you can connect to the VM via SSH, and you want to analyze the details of the
155
153
156
154
Here are two methods to repair the VM offline:
157
155
158
-
-[Use Azure Linux Auto Repair (ALAR).](#offlinetroubleshooting-repairvm)
156
+
-[Use az vm repair](#offlinetroubleshooting-repairvm)
159
157
-[Use the manual method.](#offlinetroubleshooting-manualvm)
160
158
161
-
### <aid="offlinetroubleshooting-repairvm"></a>Use Azure Linux Auto Repair (ALAR)
159
+
### <aid="offlinetroubleshooting-repairvm"></a>Use az vm repair
162
160
163
-
Azure Linux Auto Repair (ALAR) scripts are a part of the VM repair extension described in [Repair a Linux VM by using the Azure Virtual Machine repair commands](repair-linux-vm-using-azure-virtual-machine-repair-commands.md).
161
+
The `az vm repair`, part of the vm-repair extension for the Azure CLI, is described in [Repair a Linux VM by using the Azure Virtual Machine repair commands](repair-linux-vm-using-azure-virtual-machine-repair-commands.md).
164
162
165
163
Follow these steps to automate the manual offline process:
166
164
@@ -177,7 +175,7 @@ Follow these steps to automate the manual offline process:
177
175
178
176
3. Run the following commands to resolve the permission and ownership issues:
179
177
180
-
### [RHEL/CentOS](#tab/rhelts3)
178
+
### [RHEL](#tab/rhelts3)
181
179
182
180
```bash
183
181
mkdir -p /var/empty/sshd
@@ -210,11 +208,11 @@ Follow these steps to automate the manual offline process:
210
208
211
209
### <aid="offlinetroubleshooting-manualvm"></a>Use the manual method
212
210
213
-
If both the serial console and ALAR approach don't apply to you or fail, the repair has to be performed manually. Follow the steps below to manually attach the OS disk to a recovery VM and swap the OS disk back to the original VM:
211
+
If both the serial console and `az vm repair` approach don't apply to you or fail, the repair has to be performed manually. Follow the steps below to manually attach the OS disk to a recovery VM and swap the OS disk back to the original VM:
214
212
215
213
-[Attach the OS disk to a recovery VM using the Azure portal.](troubleshoot-recovery-disks-portal-linux.md)
216
214
-[Attach the OS disk to a recovery VM using Azure CLI.](troubleshoot-recovery-disks-linux.md)
217
215
218
-
Once the OS disk is successfully attached to the recovery VM, follow the detailed [chroot instructions](chroot-environment-linux.md) to mount and chroot to the filesystems of the attached OS disk. Then, follow step 3 in the [Use Azure Linux Auto Repair (ALAR)](#offlinetroubleshooting-repairvm) section to resolve the permission and ownership issues.
216
+
Once the OS disk is successfully attached to the recovery VM, follow the detailed [chroot instructions](chroot-environment-linux.md) to mount and chroot to the filesystems of the attached OS disk. Then, follow step 3 in the [Use az vm repair](#offlinetroubleshooting-repairvm) section to resolve the permission and ownership issues.
219
217
220
218
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
0 commit comments