renku-python icon indicating copy to clipboard operation
renku-python copied to clipboard

Wrong user permissions in local renku sessions

Open cmdoret opened this issue 3 years ago • 4 comments

Describe the bug

When using renku session to start a session locally, the user does not have permission to edit workflows that were created in online renku sessions.

Details

Looks like the UID does not match and write permission is not set for others.

$ ls -l .renku/metadata/ | head
total 112
drwxrwxr-x 14 1001 1001 4096 Apr 29 09:09 ./
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 ../
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 1e/
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 42/
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 48/
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 4d/
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 5e/
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 6a/
drwxrwxr-x  3 1001 1001 4096 Apr 29 09:09 90/
$ echo $UID
1000

Reproduce

  1. Create a renku project
  2. Create a workflow in an online session
  3. Clone and start local session
  4. try to remove / edit the workflow

Example project with a single workflow here: https://renkulab.io/projects/cyril.matthey-doret/session-permissions

Renku version: 1.2.2 OS: Linux (#45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022) Python: 3.9.7

Traceback

Traceback (most recent call last):
  File "[...]/renku/ui/cli/exception_handler.py", line 128, in main
    result = super().main(*args, **kwargs)
  File "[...]/renku/ui/cli/exception_handler.py", line 92, in main
    return super().main(*args, **kwargs)
  File "[...]/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "[...]/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "[...]/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "[...]/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "[...]/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "[...]/renku/ui/cli/workflow.py", line 752, in remove
    remove_workflow_command().build().execute(name=name, force=force)
  File "[...]/renku/command/command_builder/command.py", line 297, in execute
    hook(self, context, result, *args, **kwargs)
  File "[...]/renku/command/command_builder/database.py", line 67, in _post_hook
    self.dispatcher.finalize_dispatcher()
  File "[...]/renku/command/command_builder/database_dispatcher.py", line 59, in finalize_dispatcher
    self.pop_database()
  File "[...]/renku/command/command_builder/database_dispatcher.py", line 54, in pop_database
    popped_database[0].commit()
  File "[...]/renku/infrastructure/database.py", line 431, in commit
    self._store_object(object)
  File "[...]/renku/infrastructure/database.py", line 436, in _store_object
    self._storage.store(filename=self._get_filename_from_oid(object._p_oid), data=data, compress=compress)
  File "[...]/renku/infrastructure/database.py", line 740, in store
    with open(path, "wb") as f, self.zstd_compressor.stream_writer(f) as compressor:
PermissionError: [Errno 13] Permission denied: '/home/jovyan/work/.renku/metadata/5e/0b/5e0bb95c6b794fb577afca857391712791308976a3c80eb148c29c83269c938d'

cmdoret avatar Apr 29 '22 09:04 cmdoret

@cmdoret I can't reproduce this with the latest version of renku-python (1.3.1) - could you try upgrading and see if it fixes the problem?

rokroskar avatar Jun 03 '22 23:06 rokroskar

Upgrading Renku did not solve the issue. I tried on another Ubuntu machine: same docker/renku/python versions and could not reproduce the issue.

The only difference I could find is that the host UID is 1001 on the machine where it doesn't work. I failed to reproduce the issue on two machines, but the host UID was 1000 on both. Idk if it is relevant.

cmdoret avatar Jun 04 '22 00:06 cmdoret

Which docker and Ubuntu version?

rokroskar avatar Jun 04 '22 11:06 rokroskar

ubuntu 20.04, docker 20.10.12

cmdoret avatar Jun 04 '22 22:06 cmdoret