Skip to content

Commit

Permalink
Add comment about why we don't use /tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Oct 26, 2024
1 parent 889b87e commit 08b7da5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def jupyter_server(random_port):
'--no-browser'
]
env = os.environ.copy()

# sshd requires that the path to the authorized keys (and every ancestor) is fully owned
# by the user who is trying to log in (or root), and mode is not group or world writeable.
# Since that's not necessarily true for `/tmp`, we can not put our keys there for tests.
# Create them instead in cwd, which we assume matches this description instead. We
# clean up after ourselves.
dir_prefix = os.path.join(os.getcwd(), "tmp-")
with tempfile.TemporaryDirectory(prefix=dir_prefix) as temp_dir:
os.chmod(temp_dir, 0o700)
Expand Down

0 comments on commit 08b7da5

Please sign in to comment.