MacOS – OSX default file permissions when copying/saving files

apachemacospermission

Every time I save a file from a web browser or copy files from our local server to my machine, the default permission "for everyone" is set to none.
I'm a web developer. Files that are non-readable will not be displayed when accessed from an Apache server.

That means I always have to go through every file manually and change their permissions.

Is there a way to tell OSX that all files should be readable?

Best Answer

From the terminal you can use the chmod command to change permissions. In this case the command would be chmod a+r *. This would change all files in a folder. If you want to do this from the Finder, you would have to create a service. You could then select a group of files and change all of them at once. The instructions are given below.

  1. Open the Automator application.
  2. Select "Service" and click "Choose".
  3. Drag the action "Run AppleScript" to where it says "Drag actions or files here to build your workflow".
  4. Set "Service receives selected text in any application" to "Service receives selected files or folders in Finder".
  5. Replace the code

    on run {input, parameters}
    
        (* Your script goes here *)
    
        return input
    end run
    

    with

    on run {input, parameters}
        try
            repeat with currentfile in input
                try
                    do shell script "chmod a+r " & quoted form of POSIX path of currentfile
                end try
            end repeat
        end try
        return input
    end run
    
  6. Save service as "Readable by All".
  7. Quit the Automator application.

The service should have been saved in the ~/Library/Services folder under the name Readable by All.workflow. If not, move it there.

Now when you highlight one or more files using the Finder application, you can right click and select "Readable by All" to change the permissions.