diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py index 94616f59a..5fa99ed41 100644 --- a/src/python-lxc/lxc/__init__.py +++ b/src/python-lxc/lxc/__init__.py @@ -32,6 +32,7 @@ import warnings warnings.warn("The python-lxc API isn't yet stable " "and may change at any point in the future.", Warning, 2) + class ContainerNetwork(): props = {} @@ -142,6 +143,9 @@ class Container(_lxc.Container): Creates a new Container instance. """ + if os.geteuid() != 0: + raise Exception("Running as non-root.") + _lxc.Container.__init__(self, name) self.network = ContainerNetworkList(self)