mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
fix permissions on initial install
running installer as root allows some file ownership from the archive to be set as a user other than root
This commit is contained in:
@@ -76,6 +76,13 @@ def install_miniconda(installer_path, prefix):
|
|||||||
'-u', '-b',
|
'-u', '-b',
|
||||||
'-p', prefix
|
'-p', prefix
|
||||||
], stderr=subprocess.STDOUT)
|
], stderr=subprocess.STDOUT)
|
||||||
|
# fix permissions on initial install
|
||||||
|
# a few files have the wrong ownership and permissions initially
|
||||||
|
# when the installer is run as root
|
||||||
|
subprocess.check_call(
|
||||||
|
["chown", "-R", "{}:{}".format(os.getuid(), os.getgid()), prefix]
|
||||||
|
)
|
||||||
|
subprocess.check_call(["chmod", "-R", "o-w", prefix])
|
||||||
|
|
||||||
|
|
||||||
def pip_install(prefix, packages, editable=False):
|
def pip_install(prefix, packages, editable=False):
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import sys
|
import argparse
|
||||||
import os
|
import os
|
||||||
import tljh.systemd as systemd
|
import secrets
|
||||||
import tljh.conda as conda
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen, URLError
|
from urllib.request import urlopen, URLError
|
||||||
from tljh import user
|
|
||||||
import secrets
|
|
||||||
import argparse
|
|
||||||
import time
|
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
from tljh import conda, systemd, user
|
||||||
|
|
||||||
INSTALL_PREFIX = os.environ.get('TLJH_INSTALL_PREFIX', '/opt/tljh')
|
INSTALL_PREFIX = os.environ.get('TLJH_INSTALL_PREFIX', '/opt/tljh')
|
||||||
HUB_ENV_PREFIX = os.path.join(INSTALL_PREFIX, 'hub')
|
HUB_ENV_PREFIX = os.path.join(INSTALL_PREFIX, 'hub')
|
||||||
USER_ENV_PREFIX = os.path.join(INSTALL_PREFIX, 'user')
|
USER_ENV_PREFIX = os.path.join(INSTALL_PREFIX, 'user')
|
||||||
@@ -193,6 +194,9 @@ def main():
|
|||||||
|
|
||||||
ensure_usergroups()
|
ensure_usergroups()
|
||||||
ensure_user_environment(args.user_requirements_txt_url)
|
ensure_user_environment(args.user_requirements_txt_url)
|
||||||
|
# Weird setuptools issue creates a few world-writable metadata files.
|
||||||
|
# Fix it:
|
||||||
|
subprocess.check_call(["chmod", "-R", "o-w", os.path.join(HUB_ENV_PREFIX, "pkgs")])
|
||||||
|
|
||||||
print("Setting up JupyterHub...")
|
print("Setting up JupyterHub...")
|
||||||
ensure_jupyterhub_package(HUB_ENV_PREFIX)
|
ensure_jupyterhub_package(HUB_ENV_PREFIX)
|
||||||
|
|||||||
Reference in New Issue
Block a user