diff --git a/src/Tgstation.Server.Host/Components/InstanceManager.cs b/src/Tgstation.Server.Host/Components/InstanceManager.cs index b56f9c0dd3..c984de9ad2 100644 --- a/src/Tgstation.Server.Host/Components/InstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/InstanceManager.cs @@ -676,9 +676,15 @@ namespace Tgstation.Server.Host.Components if (!systemIdentity.CanCreateSymlinks) throw new InvalidOperationException($"The user running {Constants.CanonicalPackageName} cannot create symlinks! Please try running as an administrative user!"); - if (systemIdentity is PosixSystemIdentity posixIdentity && posixIdentity.IsRoot()) + if (!platformIdentifier.IsWindows && systemIdentity.IsSuperUser!.Value) { - logger.LogWarning("TGS is being run as the root account. This is not recommended and may prevent launch in a future version."); + if (systemIdentity.IsSuperUser is not { } superUser) + { + throw new InvalidOperationException("Failed to determine if running as root."); + } + + if (superUser) + logger.LogWarning("TGS is being run as the root account. This is not recommended and may prevent launch in a future version."); } }