From 91671623f0e6b25624a0f46b63bd1bf4b7d96c20 Mon Sep 17 00:00:00 2001 From: Tianhao-Gu Date: Wed, 11 Sep 2024 22:29:38 -0500 Subject: [PATCH] change default permission --- src/jupyterhub_config/custom_spawner.py | 4 ++-- test/src/jupyterhub_config/custom_spawner_test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jupyterhub_config/custom_spawner.py b/src/jupyterhub_config/custom_spawner.py index 064b9cc..0ba1e02 100644 --- a/src/jupyterhub_config/custom_spawner.py +++ b/src/jupyterhub_config/custom_spawner.py @@ -120,8 +120,8 @@ def _ensure_user_directory(self, user_dir: Path, username: str): # Change the directory's ownership to the user os.chown(user_dir, uid, gid) - # Set directory permissions to 700: Owner (rwx), Group (---), Others (---) - os.chmod(user_dir, 0o700) + # Set directory permissions to 750: Owner (rwx), Group (r-x), Others (---) + os.chmod(user_dir, 0o750) else: self.log.info(f'Reusing user directory for {username}') diff --git a/test/src/jupyterhub_config/custom_spawner_test.py b/test/src/jupyterhub_config/custom_spawner_test.py index ba9bd91..9d7cc3e 100644 --- a/test/src/jupyterhub_config/custom_spawner_test.py +++ b/test/src/jupyterhub_config/custom_spawner_test.py @@ -192,8 +192,8 @@ def test_ensure_user_directory_with_logging(mock_chown, mock_getpwnam, caplog): # Check directory permissions st = os.stat(user_dir) - # Permissions should be 0o700 (rwx------) - assert (st.st_mode & 0o777) == 0o700 + # Permissions should be 0o750 (rwxr-x---) + assert (st.st_mode & 0o777) == 0o750 # Check log messages assert f'Getting user info for {username}' in caplog.text