mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Merge pull request #1128 from minrk/check-for-geteuid
only check for AttributeError on os.geteuid
This commit is contained in:
commit
6c87dd9246
@ -1109,12 +1109,16 @@ class NotebookApp(JupyterApp):
|
||||
|
||||
This method takes no arguments so all configuration and initialization
|
||||
must be done prior to calling this method."""
|
||||
try:
|
||||
if os.geteuid() == 0:
|
||||
|
||||
if not self.allow_root:
|
||||
# check if we are running as root, and abort if it's not allowed
|
||||
try:
|
||||
uid = os.geteuid()
|
||||
except AttributeError:
|
||||
uid = -1 # anything nonzero here, since we can't check UID assume non-root
|
||||
if uid == 0:
|
||||
self.log.critical("Running as root is not recommended. Use --allow-root to bypass.")
|
||||
self.exit(1)
|
||||
except AttributeError as e:
|
||||
pass
|
||||
|
||||
super(NotebookApp, self).start()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user