Skip to content

Commit

Permalink
change default permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Sep 12, 2024
1 parent 8e31313 commit 9167162
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/jupyterhub_config/custom_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
4 changes: 2 additions & 2 deletions test/src/jupyterhub_config/custom_spawner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9167162

Please sign in to comment.