0

I have a directory where a lot of bash scripts or .sh files exist. I want to change their permissions to 770 (rwxrwx---) with the chmod command.

How can I accomplish that?

Ouki
  • 5,962
  • This post and answer explains chmod usage and file permissions: https://unix.stackexchange.com/questions/183994/understanding-unix-permissions-and-file-types – Tamas H. May 21 '19 at 07:44

2 Answers2

2
sudo chmod 770 /path/to/your/folder/*.sh

This will set the file permissions to 770 for all .sh files in the directory /path/to/your/folder/

Panki
  • 6,664
  • No need for -R in this case, would only lead to unintended changes if a directory with other files was named something.sh. – Tamas H. May 21 '19 at 07:59
  • 1
    @TamasH. Thanks, you're right. Got carried away a little by the other answer. – Panki May 21 '19 at 08:00
-1

Best way is using find command with the -exec option where you can use chmod.
$ find /my/bashfiles/ -type d -name *.c -exec chmod 770 {} \;
enter link description hereread below: https://www.poftut.com/set-permission-folders-subfolders-linux/

  • This command will find directories which end with .c, which is not at all what the OP asked. – Panki May 23 '19 at 07:46