Hoffman2:Scripts:fix perms.sh

From Center for Cognitive Neuroscience
Jump to navigation Jump to search

Back to Hoffman2 Scripts

Use Cases

  • You are collaborating with another researcher on a data set and you want to make sure all files are editable by the both of you. You need to make sure group read/write permissions are enabled and you both belong to a common group.
  • Your research group maintains a central data repository and different members are responsible for processing subjects at different stages. But everyone needs access to all the files created. Use this to make sure read/write permissions are enabled on that centrally located directory for the group.


Help/Usage

 $ fix_perms.sh --help

    fix_perms.sh

    This tool changes the permissions of any file owned by the
    executing user to have group read/write/execute permissions.
    Given an argument that points to a directory that exists 
    in the filesystem, it will run recursively on that.
   
    USAGE:
      $ fix_perms.sh
        or
      $ fix_perms.sh -h
        or
      $ fix_perms.sh --help
    To see this usage message.

      $ fix_perms.sh /path/to/directory
    Will recursively search the directory given as an argument
    for files owned by the executing user.  Any files that do
    not have group read/write/execute permission will be given
    such.

      $ fix_perms.sh -q /path/to/directory
    Will do the same changing of permissions, but suppress the
    output of the find and chmod commands so that the process
    happens quietly.  Useful if you run this command on 
    directories everytime you login as a background process
    and would like to not be bombarded by lines and lines
    of output.