Hoffman2:Scripts:fix perms.sh: Difference between revisions

From Center for Cognitive Neuroscience
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 14: Line 14:
     This tool changes the permissions of any file owned by the
     This tool changes the permissions of any file owned by the
     executing user to have group read/write/execute permissions.
     executing user to have group read/write/execute permissions.
     Given no arguments, this permissions change is done
     Given an argument that points to a directory that exists  
    recursively on the current directory. Given an argument
    in the filesystem, it will run recursively on that.
    that points to a directory that exists in the filesystem,
    it will run recursively on that.
    
    
     USAGE:
     USAGE:
      $ fix_perms.sh
        or
       $ fix_perms.sh -h
       $ fix_perms.sh -h
         or
         or
Line 25: Line 25:
     To see this usage message.
     To see this usage message.


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

Latest revision as of 00:13, 18 May 2017

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.