distrax.utils.fileio.change_ownership#

distrax.utils.fileio.change_ownership(path, user, group, admin=False)[source]#

Change the ownership of a file or directory.

Parameters:
  • path (str) – path to file/directory to change

  • user (str) – the user to change ownership to

  • group (str) – the group to change ownership to

  • admin (bool) – To run under escalted privileges

Return type:

bool

Returns:

True if successful else False

Examples

>>> distrax.utils.fileio.change_ownership("file",user="user",group="grp")
True
>>> distrax.utils.fileio.change_ownership("no_file",user="user",group="grp")
False