Skip to content

Permission denied issue when writing to /tmp/.tensorboard-info #2010

Closed
@tete1030

Description

@tete1030
  • TensorBoard version (from pip package, also printed out when running tensorboard)
    1.13.1
  • TensorFlow version if different from TensorBoard
    1.13.1
  • OS Platform and version (e.g., Linux Ubuntu 16.04)
    Ubuntu 16.04
  • Python version (e.g. 2.7, 3.5)
    2.7

Please describe the bug as clearly as possible, and if possible provide a minimal example (code, data, and/or command line) to reproduce the issue. Thanks!

The writing of tensorboard info files introduced in #1806 can cause permission problem under multi-user scenario. It directly create .tensorboard-info directory under /tmp as in

path = os.path.join(tempfile.gettempdir(), ".tensorboard-info")
. If the dir has already been created by an user, it will not be writable to other users.

image

Activity

changed the title [-]Permission denied issue when creating /tmp/.tensorboard-info[/-] [+]Permission denied issue when writing to `/tmp/.tensorboard-info`[/+] on Mar 14, 2019
wchargin

wchargin commented on Mar 14, 2019

@wchargin
Contributor

Hi @tete1030! Thanks for the clear report. This is a good point—I’d
considered the multi-user case and determined that it wouldn’t be a
problem for reading files in this directory, but didn’t realize that
it would not be possible to write new files in the directory.

I think that the following patch should suffice, at least on Unices:

diff --git a/tensorboard/manager.py b/tensorboard/manager.py
index a86c010b..92f7601f 100644
--- a/tensorboard/manager.py
+++ b/tensorboard/manager.py
@@ -235,6 +235,7 @@ def _get_info_dir():
   The directory will be created if it does not exist.
   """
   path = os.path.join(tempfile.gettempdir(), ".tensorboard-info")
+  old_umask = os.umask(0o000)
   try:
     os.makedirs(path)
   except OSError as e:
@@ -242,6 +243,8 @@ def _get_info_dir():
       pass
     else:
       raise
+  finally:
+    os.umask(old_umask)
   return path
 

I’ll have to test this on Windows. If you’re looking for a quick fix,
you should be able to patch your TensorBoard install as above. (Or just
chmod a+w /tmp/.tensorboard-info, which will work until the next time
that /tmp/ is cleared.)

Harshini-Gadige

Harshini-Gadige commented on Apr 4, 2019

@Harshini-Gadige

@tete1030 Any update on this ?
@wchargin Please let me know if you want me to keep this issue open until Windows test ?

tete1030

tete1030 commented on Apr 5, 2019

@tete1030
Author

Sorry that I didn't reply. The patch works great and I have not encountered this problem again.

wchargin

wchargin commented on Apr 5, 2019

@wchargin
Contributor

Great—glad to hear that the patch is working, @tete1030 (and sorry for
the inconvenience).

@hgadig: Yes, please keep this open.

lebrice

lebrice commented on Apr 18, 2019

@lebrice

Hey there, just stumbled upon this, I just thought I'd mention that this patch doesn't fix the issue from the non-sudo user perspective. I added the patch first, but It did not fix the problem, as I do not have write access on that directory anyway. I'm gonna try and change the ".tensorboard-info" name to something unique, and hope this works. I'm thinking it might be nice to be able to customize this location, on a per-user basis ?

wchargin

wchargin commented on Apr 18, 2019

@wchargin
Contributor

@lebrice, could you clarify what you mean by the “non-sudo user
perspective”? I can see from @tete1030’s screenshot that they’re not
running as root or with sudo. Does your user account not have write
access to $TMPDIR?

(To be clear, the patch needs to be applied before the info directory
is first created. If you’ve created a write-restricted info directory as
root by running TensorBoard without this patch, then yes, you’ll need to
remove it or change its mode.)

31 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @noisychannel@reactivetype@tete1030@wchargin@SimonSelg

    Issue actions

      Permission denied issue when writing to `/tmp/.tensorboard-info` · Issue #2010 · tensorflow/tensorboard