3

I have a folder with some files, which each have different permissions. Some are read-only, some are read/write, some are read/execute.

How can I copy the permissions from user to group, so that for example a file marked read-write for user will be set to read-write for group, but a file read-executable for a user will be set read-executable for the group.

Can this be done with a single command?

1 Answer 1

4

chmod from coreutils understands such assignments:

chmod g=u file 
1
  • just a joke :) #! /bin/bash for FILE in * do chmod g=$(ls -l $FILE | cut -c 2,3,4) $FILE done Commented Apr 4, 2013 at 14:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.